M106 remap to M67

More
31 Mar 2021 09:51 - 31 Mar 2021 09:53 #204198 by robertspark
is there a way to create a new mcode (m106) which would allow for a synchronous remap to M67

looking for options to easily remap lightburn output.... it seems that they have output grbl for pwm control


I have asked on the lightburn forum about why they are using M106 with what they have listed as a Linuxcnc post processor, so maybe they can sort out their end. They don't seem to provide easy access t edit the post processor (like you can in sheetcam) and you can change stuff according to your needs
Last edit: 31 Mar 2021 09:53 by robertspark.

Please Log in or Create an account to join the conversation.

More
31 Mar 2021 10:41 #204201 by andypugh
Replied by andypugh on topic M106 remap to M67
Maybe... Have you looked at the remap docs?

linuxcnc.org/docs/2.8/html/remap/remap.html

That says that M100 to M199 are already defined as user M-codes, and should not be remapped. But you could try it and see what happens.

Does M106 need to look _exactly_ like M67? What does an M106 command look like?

An alternative would be an input filter (you can configure LinuxCNC to run g-code through a filter when it is loaded) that changes M106 to M67.)

The best place to fix it would be in the postprocessor, though, as you have already noted.
The following user(s) said Thank You: robertspark

Please Log in or Create an account to join the conversation.

More
31 Mar 2021 12:03 #204207 by robertspark
Replied by robertspark on topic M106 remap to M67
thanks Andy

the M106 just looks like this

M106 S1000
.....
M106 S500

(you can rescale the S val in lightburn ).... almost the only adjustment given

I filter may be an interesting idea to swap out m106 for M67 even if just to learn about

Please Log in or Create an account to join the conversation.

More
31 Mar 2021 12:15 #204210 by andypugh
Replied by andypugh on topic M106 remap to M67
It _might_ be as easy as creating a file called remap106.ngc
O<remap106> SUB
  M67 E0 Q#<S>
O<remap106> ENDSUB
M2

And adding to the INI
[RS274NGC]
REMAP=M106 argspec=S ngc=remap106
The following user(s) said Thank You: robertspark

Please Log in or Create an account to join the conversation.

More
29 Apr 2021 01:57 - 29 Apr 2021 01:58 #207346 by jlund
Replied by jlund on topic M106 remap to M67
Could the following be used to convert the 0-1000 supplied by Lightburn to the 0-1 required by the M67?

For example S500 would be 500/1000 = 0.5
Resulting in M67 E0 Q0.5
O<remap106> SUB
  M67 E0 Q#<S/1000>
O<remap106> ENDSUB
M2
Last edit: 29 Apr 2021 01:58 by jlund. Reason: entry error

Please Log in or Create an account to join the conversation.

More
29 Apr 2021 11:14 #207358 by andypugh
Replied by andypugh on topic M106 remap to M67
I think that your syntax is wrong, but it should work.

I think it should be:
M67 E0 Q[#<S>/1000]


I would add a
(DEBUG, Speed command is #<S>)
to be sure.

Please Log in or Create an account to join the conversation.

More
17 Oct 2021 12:11 #223373 by ericg
Replied by ericg on topic M106 remap to M67
has this been resolved? I ask because I would also like to remap Lightburn code but wondered if it is possible to remap depending on the S value.
What I would like is that M106 S0 be remapped to M68 E0 Q0 and M106 S500 be remapped to M67 E0 Q(#<S>/1000),
I have tried reading the remap documents but it's a bit confusing for me at this stage.
Maybe one day Lightburn will have the option to do this in their PP.
thanks
Eric

Please Log in or Create an account to join the conversation.

More
21 Oct 2021 21:48 #223839 by andypugh
Replied by andypugh on topic M106 remap to M67
I am not sure that you can remap M106. That is in the M100-M199 range that is used for a traditional mode of custom command.
(And, as M100 and friends run an external execuatable I doubt that realtime performance is preserved)

The docs say "All M-codes from M100 to M199 are user-defined M-codes already, and should not be remapped." But if I were you I might be tempted to try it to see what actually happens.

Please Log in or Create an account to join the conversation.

More
21 Oct 2021 22:00 #223840 by ericg
Replied by ericg on topic M106 remap to M67
Thanks for the response Andy, I did read that so not sure if it would work either, but I made a work around by creating a bash script with 2 sed commands (been ages since I did any bash scripting)
FYI or anyone else reading this my bash script is
#!/bin/bash
sed -i 's/M106 S0/G68 E0 Q0/g' $1
sed -i 's/M106 S/G67 E0 Q/g' $1
I saved it as RunSED (no imagination)
made it executable chmod +x RunSED
and then run it with ./RunSED 'filename'
seems to work OK
Eric

Please Log in or Create an account to join the conversation.

More
21 Oct 2021 22:52 #223849 by andypugh
Replied by andypugh on topic M106 remap to M67
You can configure LinuxCNC to automatically run files through the filter before executing them.
linuxcnc.org/docs/2.8/html/config/ini-co...html#_filter_section

Please Log in or Create an account to join the conversation.

Time to create page: 0.078 seconds
Powered by Kunena Forum