soubroutines update values from gui interface problem

13 Sep 2018 15:40 - 13 Sep 2018 15:41 #117468 by k-1
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


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

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?

Last edit: 13 Sep 2018 15:41 by k-1. Reason: grammar
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
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.
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.
15 Sep 2018 07:33 #117570 by k-1
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 <= gladevcp.mytogglebutton1
net my digital-in1 <= gladevcp.mytogglebutton2

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


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)

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: k-1
Time to create page: 0.066 seconds
Powered by Kunena Forum