offtopic: remora documentation

More
03 Nov 2019 06:24 #149471 by cmorley
hal.set_p()
Is used to set pins that can be written to - HAL_IN or HAL_IO
It then checks to see if there is a signal already connected to a pin and if there is it refuses to write to it.

Your program breaks those rules.

h = P
sets your component's pin which doesn't have these restrictions.
But I'm surprised it works more then once.

I suppose each time it makes a component connects the pins sets the pin then closes the component and breaks the connection.
IIRC when a signal is disconnected from a pin it keeps it's last value so that is probably why it works.

I wouldn't do it this way but if it works - it works :)

Chris

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

More
03 Nov 2019 06:25 - 03 Nov 2019 06:26 #149472 by scotta
Ok, a working Python Mcode script that sets an existing HAL signal.
#!/usr/bin/env python2

# Note! Change the above "python2" to "python" is not using Arch Linux

# M code to set EXTRUDER 0 temperature
# M104 in your G code program will run the python code in this file, 
# passing the P and Q variables as command line arguments.

import sys
import hal

Mcode = 'M104'
usage = 'Extruder temperature'
pin = 'SP'
signal = 'ext0-SP'

h = hal.component(Mcode)

print "Usage: " + Mcode + " Pn - where n is the " + usage

P = sys.argv[1]
Q = sys.argv[2]

print 'Setting ' + usage + ' to ' + P

h.newpin(pin, hal.HAL_FLOAT, hal.HAL_IN)
hal.connect(Mcode + '.' + pin, signal)

h[pin] = P

Chris, thanks for your help. the hal.set_p thing is a bit strange...

Regards

Scott
Last edit: 03 Nov 2019 06:26 by scotta.

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

More
03 Nov 2019 06:33 #149473 by cmorley
Glad you got it to work.

set_p works on the HAL system it's the same code as typing setp in HAL and has the same restrictions.

The hal[] = is from inside the component so the direction of the pins are opposite.
(you wouldn't write to the component's IN pin, nor read the OUT pin)

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

More
17 Apr 2021 14:34 - 17 Apr 2021 14:42 #206192 by tjtr33
Hello scotta,
I am waiting for 2 MKS SGEN L v1.0 pcbs to try your Remora module with linuxCNC. They use the LPC1769 so may work with Remora. Could you tell me how you made the diagram for linuxcnc <--> remora? This is in the E-Stop loop section. It looked like XOD but only similar.. Graphic documentation of Hal nets is an on-going interest of mine.
TomP
( tjtr33 )
Last edit: 17 Apr 2021 14:42 by tjtr33.

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

More
17 Apr 2021 21:33 #206230 by scotta
Hi,

Thanks for your interest in Remora. There are a few people discovering this project and have it up and running on printers and mills. I'm trying to keep up with features.

I like the graphical representation of HAL. An easy way of explaining how the "wiring" works. This is one of the great strengths of LinuxCNC but one of the hardest for people to get their head around.

Many applications are now using a node approach for work flows and I stole the colour scheme from DaVinci Resolve and drew it up in PowerPoint unfortunately. I'd love to see a graphical tool to create the HAL files. But beyond me I'm afraid.

BR
Scott

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

Time to create page: 0.185 seconds
Powered by Kunena Forum