MDI100-199 Commands

More
29 Sep 2019 13:37 #146557 by amiba
MDI100-199 Commands was created by amiba
I did wrote some MDIxxx Shell Script commands and was surprised, that it gives me all the time the two Parameter P and Q over als a float even if there isn't a command given. Worse is that it gets the value of -1.0 if there isn't a Parameter named in the GCode. Because I do not see how to differ between a value of -1.0 and a not even given value.

Example:
#!/bin/bash
echo $# $1 $2 > logfile
with GCode:
M100 P0 Q0 give me the output of "2 0.0 0.0"
M100 P0 give me the output of "2 0.0 -1.0"
M100 give me the output of "2 -1.0 -1.0"

Where I wanted to build a function that is working in a main usage way if no P and Q ist given and a special when it is given.

I don't know if I do something wrong because I am new to this and have much more questions.

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

More
29 Sep 2019 13:42 #146559 by pl7i92
Replied by pl7i92 on topic MDI100-199 Commands
hi
welcome you can use if then or eQ
LT GT
see the gcode to get things done your way
www.linuxcnc.org/docs/html/gcode.html

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

More
29 Sep 2019 13:52 #146564 by amiba
Replied by amiba on topic MDI100-199 Commands
I now to write a bash script but I don't know how I get it that there is no Q or Q-1.0 or how if there is no P or P-1.0 because my script did not well because it was getting a value of -1.0 for $1 or -1.0 für $2 when in the GCode was not any input for P or Q

But I do need the value -1.0 as well and it should be a different thing than if ther isn't a value. I do want to diff the two cases: GCode M100 and M100 P-1.0 and this is actual not possible as I get always in both cases the command M100 -1.0 -1.0 what makes it impossible to decide that there isn't a P given or not.

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

More
29 Sep 2019 14:15 #146570 by pl7i92
Replied by pl7i92 on topic MDI100-199 Commands
on all systems
the -1 is NO VALUE if you inizialazise a parameter without value given

the call is like linuxcnc.org/docs/html/gcode/o-code.html#cha:o-codes shown here

Question what are you trying to adchive there might be some ready made to help you

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

More
29 Sep 2019 14:49 #146580 by amiba
Replied by amiba on topic MDI100-199 Commands
ok that is a help for user. How to create such kind of functions as a predefined work around.

As for a user it should be one call like o100

that he doesn't need to write it self in each GCode that he creates for this machine.

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

More
29 Sep 2019 15:03 #146588 by amiba
Replied by amiba on topic MDI100-199 Commands
there should not be a initialisation if there is no data passed through as a shell Script doesn't need unused data forwarded.

Else there is never some differ between

M100
amd
M100 P...

as I thought, that it is M100 [Pn] [Qn] and that it is possible to differ between

M100

and

M100 P-1.0

else the M100 should be force to use P and Q if it allway us it.

For example I wrote a command to give presure in Pos 1 and 2 or both.

the common way should be both so it is easy to write

M100
ready

in that function I could get the problem sorted because the value -1.0 isn't really possible

M100 P1 does it in Position 1 and

M100 P2 does it in Position 2

but what if the value that I pas is a position that can be between -1000.00 and 1002.00

Than I must pass allways the second parameter because it will not be possible to decide if their was a parameter or not.

even to use always floate is boring but I get in scripts the .0 with ${1%.*} away.

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

More
02 Oct 2019 05:28 #146859 by andypugh
Replied by andypugh on topic MDI100-199 Commands
You might be able to achive what you want with remapping. (that also allows more parameters).
I think you can check or which parameters have been passed that way (and can pass rather more, by your own choice o letter)
Though you pretty much need to be using Python.

If M100 etc really does pass -1 to mean "no value" then that does seem a very poor design choice.

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

More
02 Oct 2019 08:39 #146865 by pl7i92
Replied by pl7i92 on topic MDI100-199 Commands
as you aready need a main ngc to get your stuff cordinated
you can do
#5 = 105
o <[#5+6]> call

so you can decide on the main decision ngc on if then or all logic or,and what you want to call
like if we got a parameter then call m100 Parameter1
else if parameter eq 2
call M100 P1 p2
else call M100

there are many easy ways to decide

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

More
17 Nov 2019 17:08 #150530 by amiba
Replied by amiba on topic MDI100-199 Commands
I am new to this and do not really understand where i do need that ngc and how does it work and I did not use python because I do not really know it as well. I am able to use C and a bit C++ but this are old abilities - not trained ones.

I do understand to write a bash or dash script and it was working with a script so I did the script. Until now I could manage it without the real need of knowing if there is a parameter because it was only for things where the -1.0 isn't possible as a parameter but I know this will change soon.

So I would like to understand how the #5 = 105 is to understand as I understand that o will call a subroutine. But I am not sure.

I am glad to watch the machine working and I got all dependencies included.

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

Time to create page: 0.113 seconds
Powered by Kunena Forum