Skip to content

Commit ef2fb9c

Browse files
committed
Amended instcomp - exported funct same name as component for addf
example sim config changed runtests amended instcomp.asciidoc edited Signed-off-by: Mick <[email protected]>
1 parent 69a47fa commit ef2fb9c

File tree

24 files changed

+51
-97
lines changed

24 files changed

+51
-97
lines changed

configs/sim/icomp-demo-sim/core_sim.hal

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ addf motion-command-handler servo-thread
3131
addf motion-controller servo-thread
3232

3333
# link the differentiator functions into the code
34-
addf ddt_x.funct servo-thread
35-
addf ddt_xv.funct servo-thread
36-
addf ddt_y.funct servo-thread
37-
addf ddt_yv.funct servo-thread
38-
addf ddt_z.funct servo-thread
39-
addf ddt_zv.funct servo-thread
40-
41-
addf vel_xy.funct servo-thread
42-
addf vel_xyz.funct servo-thread
34+
addf ddt_x servo-thread
35+
addf ddt_xv servo-thread
36+
addf ddt_y servo-thread
37+
addf ddt_yv servo-thread
38+
addf ddt_z servo-thread
39+
addf ddt_zv servo-thread
40+
41+
addf vel_xy servo-thread
42+
addf vel_xyz servo-thread
4343

4444
# create HAL signals for position commands from motion module
4545
# loop position commands back to motion module feedback

configs/sim/icomp-demo-sim/movetest_mill.ngc

Lines changed: 0 additions & 17 deletions
This file was deleted.

configs/sim/icomp-demo-sim/sim_spindle_encoder.hal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ setp near_speed.difference 10
3838
net spindle-speed-cmd => near_speed.in1
3939
net spindle-at-speed near_speed.out motion.spindle-at-speed
4040

41-
addf limit_speed.funct servo-thread
42-
addf spindle_mass.funct servo-thread
43-
addf near_speed.funct servo-thread
41+
addf limit_speed servo-thread
42+
addf spindle_mass servo-thread
43+
addf near_speed servo-thread
4444

4545
addf sim_spindle servo-thread

configs/sim/icomp-demo-sim/simulated_home.hal

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ net Xhomesw => or2_0.in0
3030
net Zhomesw => or2_0.in1
3131
net XZhomesw or2_0.out => axis.0.home-sw-in axis.2.home-sw-in
3232

33-
addf comp_x.funct servo-thread
34-
addf comp_y.funct servo-thread
35-
addf comp_z.funct servo-thread
36-
addf or2_0.funct servo-thread
33+
addf comp_x servo-thread
34+
addf comp_y servo-thread
35+
addf comp_z servo-thread
36+
addf or2_0 servo-thread

configs/sim/icomp-demo-sim/simulated_limits.hal

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ newinst i_wcomp wcomp_zhome
1515

1616
# add comparators to servo thread so they will be evaluated
1717
# every servo period
18-
addf wcomp_xmin.funct servo-thread
19-
addf wcomp_xmax.funct servo-thread
20-
addf wcomp_xhome.funct servo-thread
21-
addf wcomp_ymin.funct servo-thread
22-
addf wcomp_ymax.funct servo-thread
23-
addf wcomp_yhome.funct servo-thread
24-
addf wcomp_zmin.funct servo-thread
25-
addf wcomp_zmax.funct servo-thread
26-
addf wcomp_zhome.funct servo-thread
18+
addf wcomp_xmin servo-thread
19+
addf wcomp_xmax servo-thread
20+
addf wcomp_xhome servo-thread
21+
addf wcomp_ymin servo-thread
22+
addf wcomp_ymax servo-thread
23+
addf wcomp_yhome servo-thread
24+
addf wcomp_zmin servo-thread
25+
addf wcomp_zmax servo-thread
26+
addf wcomp_zhome servo-thread
2727

2828
# connect position feedback from step generators
2929
# to window comparators

src/hal/icomp-example/instcomp.asciidoc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,10 @@ eg
9595

9696
== Instance creation
9797

98-
*'loadrt i_somecomponent'*
99-
100-
Loads the component base making it ready for instantiation
10198

10299
*'newinst i_somecomponent somecomp <iprefix=""> <pincount=0> <other_instanceparam=> extra_arg1 extra_arg2 ......'*
103100

104-
Creates a new instance of i_somecomponent called somecomp
101+
Loads i_somecomponent and creates a new instance of i_somecomponent called somecomp
105102

106103
If iprefix is supplied, it overrules any iprefix set in the .comp file and is the prefix for all pin, param and thread names for that instance.
107104

@@ -116,7 +113,7 @@ eg
116113

117114
then
118115

119-
*'addf somecomp8.funct servo-thread'*
116+
*'addf somecomp8 servo-thread'*
120117

121118
adds the function to a thread
122119

src/hal/utils/instcomp.g

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -670,12 +670,7 @@ static int comp_id;
670670
print >>f, " .owner_id = owner_id"
671671
print >>f, " };\n"
672672

673-
strng = " rtapi_snprintf(buf, sizeof(buf),\"%s."
674-
if (name == "" or name == "_" or name == " ") :
675-
strng += "funct\", name);"
676-
else :
677-
strng += "%s.funct\", name);" % (to_hal(name))
678-
print >>f, strng
673+
print >>f, " rtapi_snprintf(buf, sizeof(buf),\"%s\", name);"
679674

680675
print >>f, " r = hal_export_xfunctf(&%s_xf, buf, name);" % to_c(name)
681676
print >>f, " if(r != 0)\n return r;"

tests/i_comps/i_abs/test.hal

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ loadrt sampler cfg=ff depth=350
44
loadusr -Wn halsampler halsampler -N halsampler -n 7
55

66
loadrt streamer cfg=f depth=350
7-
loadrt i_abs
87
loadrt threads name1=fast period1=300000
98

109
newinst i_abs abstest
@@ -13,7 +12,7 @@ net in streamer.0.pin.0 => sampler.0.pin.0 abstest.in
1312
net out abstest.out => sampler.0.pin.1
1413

1514
addf streamer.0 fast
16-
addf abstest.funct fast
15+
addf abstest fast
1716
addf sampler.0 fast
1817

1918
loadusr -w sh runstreamer

tests/i_comps/i_alias/expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
i_and2.funct.time i_and2new.funct.time i_and2new.in1 i_and2new.out something
1+
i_and2.funct.time i_and2new.in1 i_and2new.out i_and2new.time something

tests/i_comps/i_alias/test.hal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
loadrt i_and2
21
newinst i_and2 i_and2new
32
alias pin i_and2new.in0 something
43
alias pin i_and2new.in1 somethingelse

0 commit comments

Comments
 (0)