soubroutines update values from gui interface problem

More
13 Sep 2018 15:40 - 13 Sep 2018 15:41 #117468 by bkt
In the old 2.6 Lcnc whe I have a value that need to being update from gui or external input, I put it on soubroutine and call it from my primary.ngc file. If during the execution the user press "make an other way" button on axis panel an if statement see these action and perform the soubroutine... example;
o<adifferentwaytodo> sub

G21 G64 G90

G1 F50000 X500 Y900 Z900

o<adifferentwaytodo> endsub

M30

and my primary.ngc example:
G21 G64 G90
(some parameters)
(some long code)
o100 if [#<_hal[gladevcp.mydifferent_togglebutton]> EQ 1]
o<adifferentwaytodo> call
o100 else
G1 F1000 X-500 Y-900 Z-900
o100 end if
(some long code)
G1 F1000 X-500 Y-900 Z-900
M30

in the 2.6 if user change toggle button state during gcode execution, if statement perform right .... but with 2.8 master if user change toggle button state when Lcnc is in stop mode all is good, if user change during execution if statement bring only the past value of togglebutton and NOt the new one .....

there are some way to do these things in old manner?

regards
giorgio
Last edit: 13 Sep 2018 15:41 by bkt. Reason: grammar

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

More
13 Sep 2018 16:20 #117469 by Todd Zuercher
I suspect this problem is created by the read ahead done by the new trajectory planner introduced in 2.7.

The trajectory planner does have a setting to revert to the old system. In the ini file under the [TRAJ] section there should be a line
ARC_BLEND_ENABLE = 1
change the 1 to 0

Changing that setting should revert to the old 1 line look ahead system, see if that returns your old behavior.

If you want to retain the new trajectory planner, you are going to have to use a different method other than changing a parameter value, to effect your change. I would suggest using an M66 instead.

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

More
14 Sep 2018 12:34 #117521 by andypugh
G-code access to HAL pins has _never_ worked reliably during code execution.

It is, as Todd said, much better to net the toggle to a G-code input in HAL and then use M66.

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

More
15 Sep 2018 07:33 #117570 by bkt
thanks to all but I know M66 ... but never used in these situation: the user can perform more than one choose ... so 6 togglebutton ... than it can select a different velocity of certain mouvement so 4 different type of gladevcp.speedcontrol widget for example .... if use M66 can #5399 parameter change every time the gcode read M66? example:
#/*hal file*/

net my analog-in0 motion.analog-in-00 <= gladevcp.myspeedcontrol1
net my analog-in1 motion.analog-in-01 <= gladevcp.myspeedcontrol2


net my digital-in0 motion.digital-in-00 <= gladevcp.mytogglebutton1
net my digital-in1 motion.digital-in-01 <= gladevcp.mytogglebutton2

#
(/*mygcode*/)
G64 G21 G91
#<myvel1> = 0
#<myvel2> = 0
G1 F10000 X100 Y200
M66 P0 L0
o200 if[#5399 EQ 1]
(msg, perform my very different gcode)
o200 else
(msg, perform my normal different gcode)
o200 end if
G1 F10000 X-100 Y200
G1 F10000 X-100 Y-200

M66 E0 L0
#<myvel1> = #5399
G1 F#<myvel1> X100 Y-200
M66 E1 L0
#<myvel2> = #5399
G1 F#<myvel2> X100 Y200

M66 P1 L0
o201 if[#5399 EQ 1]
(msg, perform my very different gcode second type)
o201 else
(msg, perform my normal different gcode second type)
o201 end if

G1 F#<myvel1> X-100 Y-200

M2

these is possible?
Last time that I try do these things the trajectory planner "not understand" the right #5399 value every time...... (3/4 year ago)

regards
Giorgio

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

More
15 Sep 2018 09:25 #117571 by andypugh
That is exactly what I would expect to use. (If it doesn't work then something is wrong)
The following user(s) said Thank You: bkt

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

Time to create page: 0.074 seconds
Powered by Kunena Forum