[Solved]M100 bash with if then not work.....

More
24 Oct 2016 07:20 - 24 Oct 2016 17:59 #81979 by bkt
Hi,

I try to write these code into M100 custom code:
rqst=$1

if [ $rqst -eq 1 ]; then
       halcmd setp mycustomcomp.pin1 true
else
       halcmd setp mycustomcomp.pin1 false
fi

exit 0

in a terminal these program run perfet ... bun in linuxcnc not at all ....
some suggest?? (ubuntu 10.04)

Regards
giorgio
Last edit: 24 Oct 2016 17:59 by bkt.

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

More
24 Oct 2016 10:12 #81980 by newbynobi
I do not understand:

if [ $rqst -eq 1 ]; then

IMHO it should be
if [ $rqst eq 1 ]

no "-" in front of eq and no comment at the end of the line.

Does the script give any output on the terminal?

Norbert

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

More
24 Oct 2016 11:45 - 24 Oct 2016 11:59 #81985 by bkt

Hi,

I try to write these code into M100 custom code:
rqst=$1

if [ $rqst -eq 1 ]; then
       halcmd setp mycustomcomp.pin1 true
else
       halcmd setp mycustomcomp.pin1 false
fi

exit 0

in a terminal these program run perfect ... bun in linuxcnc not at all ....
some suggest?? (ubuntu 10.04)

Regards
giorgio


my code is right ... WITH -eq in if statement .... if run it in terminal no messages ... if run your code (WITHOUT -eq...."-") obtain in terminal:
linexx: [: eq: binary operator expected

But I see now that:
If I run the command in terminal with machine in pause ... the command work fine ... isf try tu run the code in my Gcode during the running of machine the code not work at all..... my ini file is
FEATURE = 28

mmm... I think at these point the problem is not M100 custom code... but mycustomcomp.... is userspace component and I try to modify it (it calculate some x-y quote) during program running with M100 .... I think LCNC2.7 not supports these as in my old 2.6 installation .... if someone can confirm my ideas....

regards
giorgio
Last edit: 24 Oct 2016 11:59 by bkt.

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

More
24 Oct 2016 13:07 #81986 by Todd Zuercher
Do you get any alarms when trying to use the M100 in Linuxcnc or does nothing appear to happen?
Do you get any pertinent messages when you run Linuxcnc from terminal and run a g-code file with the m-code?

You say it was working in 2.6, is the comp and the M-code exactly the same, or did you make changes to them?
If you changed anything what were those changes?

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

More
24 Oct 2016 15:43 - 24 Oct 2016 15:45 #81988 by bkt
The situation is similar but comp and M100 is different ... only the mechanism of transfer data is the same ... but I remember now a suggest give me from mhaleber .... in these old post c++ grab position

INTERP_EXECUTE_FINISH

I think of this because I saw that the time needed to renew mycomp.pin1 value in gcode, is much larger than the old version with LCNC 2.6 .... so I think somethings is changed in LCNC ...
Normally the changing is better .... in these case .... But is possible I'm in wrong ... can anyone tell me if I'm wrong

Regards
Giorgio
Last edit: 24 Oct 2016 15:45 by bkt.

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

More
24 Oct 2016 16:56 #81996 by bkt
mm.. I study now all the mhabeler example and remapped code ... (some discussion about blending path on new 2.7 clarify me somethings...)... but if I remap G70 as the example... I can write somethings like thee??
G64 F200000 X20 Y-400
G70
G64 F200000 X30 Y-50
G64 F200000 X20 Y900
G64 F200000 X400 Y-400
G70
G64 F200000 X340 Y-480
G64 F200000 X300 Y-700
G64 F200000 X20 Y-400
G70
G64 F200000 X500 Y-40
G64 F200000 X623 Y100
G64 F200000 X10 Y-100

M2

or the gcode stop at first G70?? ... or there will only be a stop&go motion??

Regards
Giorgio

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

More
24 Oct 2016 17:59 #82000 by bkt
no using remap code there is not a stop of gcode ....

regards
Giorgio

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

Time to create page: 0.195 seconds
Powered by Kunena Forum