Getting back to this thread...
I can now send data from a pyVCP panel to G-Code like an ACE... no problem and thanks!!!
Example: I want to evaluate the speed of a spindle and wait until it has slowed down before switching directions... so we wait until the spindle is less than 100 RPM to avoid blowing a breaker. The pyVCP has a meter with a hal pin called "spindle-speed" in actual RPM. Given this... I have learned that I can reference it in G-Code as...
#<_hal[pyvcp.spindle-speed]>
Then do whatever I need...
Code:
O <set-spindle-forward> sub
M05
o100 while [#<_hal[pyvcp.spindle-speed]> GT 99]
o100 endwhile
M03 S500
O <set-spindle-forward> endsub
So thanks so much for that... but now I'm scratching my head with something
ArcEye said about passing variables BACK to the pyvcp panel... something I could really use in a project to send canned messages by just sending a number and having graphics icons displayed... would look cool too.
I installed the following in a test panel...
Code:
<number>
<halpin>"my-number"</halpin>
<font>("Helvetica",24)</font>
<format>"+4.4f"</format>
</number>
So in G-Code I should be able to send back 123.456 and the display would show that. If I get that far... then I'll have the concept enough to create everything else. I see that there are a few parts to this... and i only need to get a handle on how they tie together... I think I'm close.
In reading
ArcEye's text... I believe I need to set up something like this in the HAL or CUSTOM_POSTGUI.HAL file... but not 100% sure...
halcmd setp pyvcp.my-number.param_pin $1
Then he said to do something like this... presumably in the G-Code...
M199 P 123
That's where I'm doing a bit of head scratching... looking up the M-Codes... I see there are
M100 to
M199 which... if I understand this correctly... are treated internally as
M1nn where
nn is
00 to
99. And if so... I would think that
halcmd setp pyvcp.my-number.param_pin $1 would reference
M101 instead of
M199... hence my confusion.
In other words...
_pin$00 to
_pin$99 to associate with
M100 through
M199 inclusive.
So I'm a bit confused... if I had five <number> boxes... let's call the halpins "alpha", "beta","charlie","delta", and "foxtrot"... I would obviously need something like...
Code:
halcmd setp pyvcp.alpha.param_pin $1
halcmd setp pyvcp.beta.param_pin $2
halcmd setp pyvcp.charlie.param_pin $3
halcmd setp pyvcp.delta.param_pin $4
halcmd setp pyvcp.foxtrot.param_pin $5
Right?
And would they then attach to
M101 through
M105?
I'll experiment... if I get it... I'll post results. It will be cool to make interactive display that tells the status of G-Code without DEBUG, MSG, or PRINT appearing on the bottom of the display.
What would REALLY be cool... would be a new TEXTBOX widget or be able to pass text to a LABEL...
hint hint.
Code:
<textbox>
<halpin>"my-display"</halpin>
<font>("Helvetica",10)</font>
<fg>#000000</fg>
<bg>#FFFFFF</bg>
</textbox>
Yeah... I'm reading...
linuxcnc.org/docs/html/man/man1/halcmd.1.html
linuxcnc.org/docs/html/hal/halmodule.html
and it's not making sense to me... :blush:
This one...
linuxcnc.org/docs/html/gcode/m-code.html...ser_defined_commands
a little bit...
but when I get to the
#!/bin/bash I'm lost... not making sense to me.