From fe5eaca8141efbb50defd52ea022e9d315cff70a Mon Sep 17 00:00:00 2001 From: Bertho Stultiens Date: Thu, 2 Jul 2026 15:34:57 +0200 Subject: [PATCH] Preliminary - HAL types update and HAL isolation --- .../gladevcp/class-callback/class_callback.py | 2 +- configs/apps/gladevcp/complex/complex.py | 6 +- configs/attic/demo_mazak/demo_mazak.hal | 4 +- configs/attic/demo_mazak/tester.hal | 54 +- .../attic/unclaimed/plasma-thc/mp1000A.hal | 8 +- .../attic/unclaimed/plasma-thc/mp1000B.hal | 8 +- configs/attic/unclaimed/plasma-thc/thc300.hal | 8 +- .../mesa/hm2-modbus/bldc_and_wavebox.mbccs | 8 +- .../hm2-modbus/hm2-stepper-eth-modbus.hal | 6 +- .../mesa/hm2-modbus/rs485io.mbccs | 8 +- .../waveshare-modbus-rtu-relay-d.mbccs | 8 +- .../mesa/hm2-servo/hm2-servo-eth.hal | 6 +- .../by_interface/mesa/hm2-servo/hm2-servo.hal | 6 +- .../mesa/hm2-stepper/hm2-stepper-eth.hal | 6 +- .../mesa/hm2-stepper/hm2-stepper-rpspi.hal | 6 +- .../mesa/hm2-stepper/hm2-stepper.hal | 6 +- .../mesa/plasma-5i20/plasma-5i20.hal | 6 +- .../parport/plasma-thc-sim/thc.hal | 8 +- .../pico/USC_encod/univstep_io.hal | 6 +- configs/by_interface/pico/ppmc/ppmc_io.hal | 4 +- .../by_interface/pico/univpwm/univpwm_io.hal | 6 +- .../by_interface/pico/univpwmv/univpwm_io.hal | 54 +- .../pico/univpwmv/univpwm_load.hal | 4 +- .../pico/univpwmv/univpwm_motion.hal | 22 +- .../pico/univpwmv/univpwm_servo.hal | 26 +- .../pico/univstep/univstep_io.hal | 6 +- configs/by_interface/servotogo/stg_io.hal | 8 +- configs/by_interface/vigilant/vti_io.hal | 46 +- .../by_interface/vitalsystems/motenc_io.hal | 2 +- configs/by_machine/scorbot-er-3/pyvcp.xml | 8 +- .../Sherline4Axis/standard_pinout.hal | 2 +- configs/by_machine/smithy/1240.hal | 2 +- configs/by_machine/smithy/1240_4axis.hal | 2 +- configs/by_machine/smithy/1240gecko.hal | 2 +- configs/by_machine/smithy/1240rutex.hal | 2 +- configs/by_machine/smithy/1240rutex_4axis.hal | 2 +- configs/by_machine/smithy/516gecko.hal | 2 +- configs/by_machine/smithy/622.hal | 2 +- configs/by_machine/smithy/622_4axis.hal | 2 +- configs/by_machine/smithy/622gecko.hal | 2 +- configs/by_machine/smithy/622keyence.hal | 2 +- configs/by_machine/smithy/622leadshine.hal | 2 +- .../by_machine/smithy/622leadshine_4axis.hal | 2 +- configs/by_machine/smithy/924.hal | 2 +- configs/common/shuttle.hal | 12 +- .../dynamic_offsets_panel.hal | 2 +- configs/sim/axis/gantry/gantry_panel.hal | 12 +- configs/sim/axis/gladevcp/meter_scale.py | 2 +- configs/sim/axis/laser/laser.hal | 2 +- .../plasma/plasmac2/lib/conversational.py | 2 +- .../plasma/plasmac2/lib/custom/user_hal.py | 2 +- .../axis/plasma/plasmac2/lib/sim/sim_panel.py | 2 +- configs/sim/axis/plasma/plasmac2/plasmac2.py | 66 +- configs/sim/axis/plasma/user_hal.py | 4 +- .../python/gladevcp-handler.py | 2 +- .../vismach/3axis-tutorial/3axis-tutorial | 10 +- .../axis/vismach/5axis/bridgemill/5axisgui.py | 16 +- .../sim/axis/vismach/5axis/max5/max5gui.py | 14 +- .../5axis/table-dual-rotary/xyzab-tdr-gui.py | 24 +- .../table-rotary-tilting/xyzac-trt-gui.py | 16 +- .../table-rotary-tilting/xyzbc-trt-gui.py | 16 +- .../python/twp-helper-comp.py | 56 +- .../vismach/xyzacb-trsrn-gui.py | 70 +- .../vismach/xyzbca-trsrn-gui.py | 70 +- .../axis/vismach/VMC_toolchange/sim_vmc.hal | 32 +- .../VMC_toolchange/toolchange_gray.hal | 8 +- .../VMC_toolchange/toolchange_index.hal | 8 +- .../sim/axis/vismach/VMC_toolchange/vmcgui | 16 +- configs/sim/axis/vismach/delta/lineardelta.py | 12 +- configs/sim/axis/vismach/delta/rotarydelta.py | 14 +- configs/sim/axis/vismach/hbm/hbmgui.py | 12 +- .../sim/axis/vismach/hexapod-sim/hexagui.py | 24 +- .../sim/axis/vismach/melfa-sim/melfagui.py | 18 +- .../sim/axis/vismach/millturn/millturngui.py | 16 +- .../vismach/orphaned models/maho600gui.py | 14 +- configs/sim/axis/vismach/puma/puma560gui.py | 14 +- configs/sim/axis/vismach/puma/pumagui.py | 12 +- configs/sim/axis/vismach/scara/scaragui.py | 12 +- .../gmoccapy/lathe_configs/lathehandler.py | 2 +- .../non_trivial_kinematics/scara/scaragui.py | 12 +- .../table-rotary-tilting/xyzac-trt-gui.py | 16 +- configs/sim/gmoccapy/plasma_config/plasma.py | 12 +- configs/sim/pyvcp_demo.xml | 8 +- .../qtdragon_hd_xyz/qtdragon_hd_postgui.hal | 12 +- .../qtdragon_hd_postgui.hal | 12 +- .../screens/qtdragon/qtdragon_handler.py | 30 +- .../qtvcp_experimental/lathehandler.py | 4 +- .../1280x1024_5axis/woodpecker_handler.py | 52 +- configs/sim/woodpecker/compensate.py | 18 +- configs/sim/woodpecker/numstr.py | 2 +- configs/sim/woodpecker/python/stdglue.py | 4 +- configs/sim/woodpecker/woodpecker.hal | 8 +- .../woodpecker_/woodpecker_handler.py | 30 +- debian/tests/linuxcnc-test-ui.py | 8 +- docs/po4a.cfg | 25 +- docs/src/common/glossary.adoc | 4 +- docs/src/config/ini-homing.adoc | 12 +- docs/src/config/python-hal-interface.adoc | 33 +- docs/src/drivers/mesa_modbus.adoc | 30 +- .../getting-started/updating-linuxcnc.adoc | 51 ++ docs/src/gui/axis.adoc | 8 +- docs/src/gui/gladevcp.adoc | 6 +- docs/src/gui/gstat.adoc | 4 +- docs/src/gui/qtdragon.adoc | 38 +- docs/src/gui/qtvcp-code-snippets.adoc | 2 +- docs/src/gui/qtvcp-libraries.adoc | 10 +- docs/src/gui/qtvcp-vcp-panels.adoc | 2 +- docs/src/gui/qtvcp-vismach.adoc | 14 +- docs/src/gui/qtvcp-widgets.adoc | 40 +- docs/src/gui/qtvcp.adoc | 6 +- docs/src/gui/vismach.adoc | 6 +- docs/src/hal/basic-hal.adoc | 135 ++- docs/src/hal/comp.adoc | 219 ++--- docs/src/hal/components.adoc | 46 +- docs/src/hal/halmodule.adoc | 28 +- docs/src/hal/parallel-port.adoc | 2 +- docs/src/man/man1/halcompile.1.adoc | 2 + docs/src/man/man1/mesambccc.1.adoc | 70 +- docs/src/man/man3/hal_create_thread.3.adoc | 5 +- docs/src/man/man3/hal_export_funct.3.adoc | 7 +- docs/src/man/man3/rtapi_task_new.3.adoc | 6 +- docs/src/man/man9/motion.9.adoc | 256 +++--- docs/src/man/man9/weighted_sum.9.adoc | 2 +- .../gtk_little_probe/gtk_little_probe.py | 30 +- .../gtk_verser_probe/gtk_verser_probe.py | 30 +- lib/python/gladevcp/core.py | 1 - lib/python/gladevcp/hal_bar.py | 2 +- lib/python/gladevcp/hal_graph.py | 2 +- lib/python/gladevcp/hal_lightbutton.py | 10 +- lib/python/gladevcp/hal_meter.py | 2 +- lib/python/gladevcp/hal_widgets.py | 46 +- lib/python/gladevcp/jogwheel.py | 2 +- lib/python/gladevcp/speedcontrol.py | 8 +- lib/python/hal.py | 20 +- lib/python/pyvcp_widgets.py | 68 +- lib/python/qtvcp/core.py | 1 - lib/python/qtvcp/lib/message.py | 14 +- lib/python/qtvcp/lib/qt_vismach/fanuc_200f.py | 16 +- .../qtvcp/lib/qt_vismach/gantry_5axis.py | 16 +- lib/python/qtvcp/lib/qt_vismach/millturn.py | 16 +- lib/python/qtvcp/qt_halobjects.py | 25 +- lib/python/qtvcp/widgets/axis_tool_button.py | 4 +- lib/python/qtvcp/widgets/bar.py | 24 +- lib/python/qtvcp/widgets/basic_probe.py | 2 +- lib/python/qtvcp/widgets/camview_widget.py | 2 +- lib/python/qtvcp/widgets/dialog_widget.py | 8 +- lib/python/qtvcp/widgets/general_hal_input.py | 8 +- .../qtvcp/widgets/general_hal_output.py | 14 +- lib/python/qtvcp/widgets/hal_label.py | 6 +- lib/python/qtvcp/widgets/hal_selectionbox.py | 45 +- lib/python/qtvcp/widgets/indicatorMixIn.py | 4 +- lib/python/qtvcp/widgets/jog_increments.py | 2 +- lib/python/qtvcp/widgets/joypad.py | 46 +- lib/python/qtvcp/widgets/led_widget.py | 2 +- lib/python/qtvcp/widgets/round_gauge.py | 4 +- lib/python/qtvcp/widgets/simple_widgets.py | 52 +- lib/python/qtvcp/widgets/state_led.py | 2 +- lib/python/qtvcp/widgets/status_slider.py | 2 +- lib/python/qtvcp/widgets/versa_probe.py | 12 +- lib/python/qtvcp/widgets/widget_baseclass.py | 10 +- lib/python/raster.py | 8 +- lib/python/vismach.py | 2 +- nc_files/remap_lib/python-stdglue/stdglue.py | 4 +- scripts/hal_demo | 8 +- .../silverdragon/silverdragon_handler.py | 16 +- .../gscreen/skins/spartan/spartan_handler.py | 14 +- .../qtplasmac_sim/qtplasmac_sim_handler.py | 18 +- .../panels/test_button/test_button_handler.py | 4 +- .../panels/test_dial/test_dial_handler.py | 2 +- .../qtvcp/panels/test_led/test_led_handler.py | 4 +- .../vismach_router_atc_handler.py | 6 +- share/qtvcp/screens/qtaxis/qtaxis_handler.py | 8 +- .../screens/qtdragon/qtdragon_handler.py | 36 +- .../qtdragon_hd/qtdragon_hd_handler.py | 44 +- .../qtdragon_hd_vert_handler.py | 44 +- .../qtdragon_lathe/qtdragon_lathe_handler.py | 36 +- .../screens/qtplasmac/qtplasmac_handler.py | 190 ++-- .../screens/qttouchy/qttouchy_handler.py | 14 +- .../screens/woodpecker/woodpecker_handler.py | 30 +- src/Makefile | 2 +- src/emc/motion/motion.c | 8 +- src/emc/rs274ngc/interp_namedparams.cc | 2 - src/emc/usr_intf/axis/scripts/axis.py | 32 +- .../axis/scripts/hal_manualtoolchange.py | 8 +- src/emc/usr_intf/axis/scripts/haltest.py | 10 - .../usr_intf/axis/scripts/tracking-test.py | 24 +- src/emc/usr_intf/gmoccapy/gmoccapy.py | 112 +-- src/emc/usr_intf/gscreen/gscreen.py | 54 +- src/emc/usr_intf/mdro/mdro.py | 4 +- src/emc/usr_intf/pncconf/options.glade | 12 +- src/emc/usr_intf/pncconf/tests.py | 44 +- src/emc/usr_intf/pyui/widgets.py | 16 +- src/emc/usr_intf/touchy/hal_interface.py | 72 +- src/hal/classicladder/module_hal.c | 2 +- src/hal/components/.gitignore | 1 + src/hal/components/Submakefile | 156 +--- src/hal/components/abs_s32.comp | 41 - .../{abs_s64.comp => abs_sint.comp} | 2 +- src/hal/components/anglejog.comp | 26 +- src/hal/components/axistest.comp | 4 +- src/hal/components/bin2gray.comp | 6 +- src/hal/components/biquad.comp | 2 +- src/hal/components/bitmerge.comp | 4 +- src/hal/components/bitslice.comp | 4 +- src/hal/components/bitwise.comp | 20 +- src/hal/components/bldc.comp | 26 +- src/hal/components/boss_plc.c | 2 +- src/hal/components/carousel.comp | 38 +- src/hal/components/comp.comp | 1 + src/hal/components/conv_real_bool.comp | 23 + src/hal/components/counter.c | 4 +- src/hal/components/dbounce.comp | 2 +- src/hal/components/debounce.c | 2 +- src/hal/components/demux.comp | 4 +- src/hal/components/demux_generic.c | 105 ++- src/hal/components/edge.comp | 14 +- src/hal/components/encoder.c | 4 +- src/hal/components/encoder_ratio.c | 4 +- src/hal/components/enum.c | 6 +- src/hal/components/eoffset_per_angle.comp | 18 +- src/hal/components/gray2bin.comp | 8 +- src/hal/components/histobins.comp | 24 +- src/hal/components/histobinstream.comp | 20 +- src/hal/components/knob2float.comp | 6 +- src/hal/components/latencybins.comp | 69 +- src/hal/components/lcd.c | 2 +- src/hal/components/limit3.comp | 2 +- src/hal/components/limit_axis.comp | 4 +- src/hal/components/matrix_kb.c | 2 +- src/hal/components/max31855.comp | 2 +- src/hal/components/mesa_pktgyro_test.comp | 2 +- src/hal/components/millturn.comp | 2 +- src/hal/components/mkconv.sh | 92 +- src/hal/components/modmath.c | 2 +- src/hal/components/momentary2nist.comp | 8 +- src/hal/components/moveoff.comp | 6 +- src/hal/components/multiclick.comp | 30 +- src/hal/components/multiswitch.comp | 4 +- src/hal/components/mux16.comp | 6 +- src/hal/components/mux_generic.c | 97 +-- src/hal/components/orient.comp | 2 +- src/hal/components/pid.c | 2 +- src/hal/components/plasmac.comp | 22 +- src/hal/components/pushmsg.comp | 29 +- src/hal/components/pwmgen.c | 4 +- src/hal/components/radiobutton.comp | 16 +- src/hal/components/raster.comp | 20 +- src/hal/components/reset.comp | 26 +- src/hal/components/safety_latch.comp | 12 +- src/hal/components/sample_hold.comp | 4 +- src/hal/components/sampler.c | 6 +- src/hal/components/sampler_usr.c | 6 - ...ed_s32_sums.comp => scaled_sint_sums.comp} | 12 +- src/hal/components/select8.comp | 4 +- src/hal/components/siggen.c | 2 +- src/hal/components/sim_encoder.c | 4 +- src/hal/components/sim_matrix_kb.comp | 2 +- src/hal/components/sphereprobe.comp | 25 +- src/hal/components/spindle.comp | 4 +- src/hal/components/spindle_monitor.comp | 2 +- src/hal/components/stepgen.c | 6 +- src/hal/components/steptest.comp | 6 +- src/hal/components/streamer.c | 6 +- src/hal/components/streamer_usr.c | 6 - src/hal/components/sum2.comp | 2 +- src/hal/components/supply.c | 2 +- src/hal/components/threads.c | 6 +- src/hal/components/threadtest.comp | 2 +- src/hal/components/time.comp | 12 +- src/hal/components/timedelta.comp | 14 +- src/hal/components/toggle.comp | 4 +- src/hal/components/toggle2nist.comp | 8 +- src/hal/components/updown.comp | 8 +- src/hal/components/userkins.comp | 2 +- src/hal/components/watchdog.c | 4 +- src/hal/components/weighted_sum.c | 6 +- src/hal/components/xhc_hb04_util.comp | 16 +- src/hal/components/xyzab_tdr_kins.comp | 2 +- src/hal/components/xyzacb_trsrn.comp | 2 +- src/hal/components/xyzbca_trsrn.comp | 2 +- src/hal/drivers/hal_ax5214h.c | 4 +- src/hal/drivers/hal_bb_gpio.c | 4 +- src/hal/drivers/hal_evoreg.c | 2 +- src/hal/drivers/hal_gm.c | 6 +- src/hal/drivers/hal_gpio.c | 6 +- src/hal/drivers/hal_motenc.c | 12 +- src/hal/drivers/hal_parport.c | 10 +- src/hal/drivers/hal_pi_gpio.c | 6 +- src/hal/drivers/hal_ppmc.c | 4 +- src/hal/drivers/hal_skeleton.c | 2 +- src/hal/drivers/hal_speaker.c | 2 +- src/hal/drivers/hal_stg.c | 12 +- src/hal/drivers/hal_tiro.c | 2 +- src/hal/drivers/hal_vti.c | 10 +- src/hal/drivers/mesa-hostmot2/abs_encoder.c | 2 +- src/hal/drivers/mesa-hostmot2/hm2_eth.c | 2 +- src/hal/drivers/mesa-hostmot2/hm2_modbus.c | 160 +--- src/hal/drivers/mesa-hostmot2/hostmot2.c | 10 +- src/hal/drivers/mesa-hostmot2/mesambccc.py | 100 ++- .../drivers/mesa-hostmot2/modbus/analogue.mod | 4 +- .../mesa-hostmot2/modbus/mesa_modbus.c.tmpl | 26 +- .../modbus/mesa_modbus.mod.sample | 18 +- .../mesa-hostmot2/modbus/relayboard.mod | 14 +- src/hal/drivers/mesa_uart.comp | 8 +- src/hal/drivers/opto_ac5.c | 4 +- src/hal/drivers/pci_8255.c | 12 +- src/hal/drivers/pcl720.comp | 8 +- src/hal/drivers/pluto_servo.comp | 119 +-- src/hal/drivers/pluto_step.comp | 83 +- src/hal/drivers/serport.comp | 2 +- src/hal/hal.h | 622 +++++-------- src/hal/hal_lib.c | 822 ++++-------------- src/hal/hal_lib_query.c | 43 +- src/hal/hal_priv.h | 201 ++--- src/hal/halmodule.cc | 121 +-- src/hal/halquery.cc | 6 +- src/hal/setps_util.c | 6 - src/hal/user_comps/hal_bridge.py | 34 +- src/hal/user_comps/hal_input.py | 38 +- src/hal/user_comps/mitsub_vfd.py | 56 +- src/hal/user_comps/mqtt-publisher.py | 6 +- src/hal/user_comps/mtconnect-agent.py | 4 +- src/hal/user_comps/pi500_vfd/pi500_vfd.comp | 4 +- src/hal/user_comps/pmx485.py | 28 +- src/hal/user_comps/scorbot-er-3.py | 8 +- src/hal/user_comps/sim-torch.py | 26 +- src/hal/user_comps/vismach/5axisgui.py | 16 +- src/hal/user_comps/vismach/hbmgui.py | 12 +- src/hal/user_comps/vismach/hexagui.py | 24 +- src/hal/user_comps/vismach/lineardelta.py | 12 +- src/hal/user_comps/vismach/maho600gui.py | 14 +- src/hal/user_comps/vismach/max5gui.py | 14 +- src/hal/user_comps/vismach/melfagui.py | 18 +- src/hal/user_comps/vismach/millturngui.py | 16 +- src/hal/user_comps/vismach/puma560gui.py | 14 +- src/hal/user_comps/vismach/pumagui.py | 12 +- src/hal/user_comps/vismach/rotarydelta.py | 14 +- src/hal/user_comps/vismach/scaragui.py | 12 +- src/hal/user_comps/vismach/xyzab-tdr-gui.py | 24 +- src/hal/user_comps/vismach/xyzac-trt-gui.py | 16 +- src/hal/user_comps/vismach/xyzbc-trt-gui.py | 16 +- src/hal/user_comps/wj200_vfd/wj200_vfd.comp | 4 +- src/hal/user_comps/xhc-hb04.cc | 6 +- src/hal/user_comps/xhc-whb04b-6/hal.cc | 16 +- src/hal/user_comps/xhc-whb04b-6/hal.h | 14 +- src/hal/user_comps/z_level_compensation.py | 18 +- src/hal/utils/halcmd_commands.cc | 44 +- src/hal/utils/halcmd_completion.c | 8 +- src/hal/utils/halcompile.g | 107 ++- src/hal/utils/halrmt.cc | 10 +- src/hal/utils/halsh.c | 12 +- src/hal/utils/meter.c | 10 - src/hal/utils/scope_disp.c | 12 - src/hal/utils/scope_files.c | 14 - src/hal/utils/scope_rt.c | 10 +- src/hal/utils/scope_trig.c | 18 - src/hal/utils/scope_vert.c | 2 - src/rtapi/examples/fifo/fifotask.c | 2 +- src/rtapi/examples/semaphore/master.c | 2 +- src/rtapi/examples/semaphore/slave.c | 2 +- src/rtapi/examples/shmem/shmemtask.c | 2 +- src/rtapi/examples/timer/timertask.c | 2 +- src/rtapi/rtai_rtapi.c | 5 +- src/rtapi/rtapi.h | 6 +- src/rtapi/uspace_rtai.cc | 2 +- src/rtapi/uspace_rtapi_app.cc | 7 +- src/rtapi/uspace_rtapi_app.hh | 3 +- src/rtapi/uspace_rtapi_main.cc | 4 +- tcl/bin/halshow.tcl | 4 +- .../on_abort_command-crazy-move/test-ui.py | 4 +- tests/abort/stop-button-crazy-move/test-ui.py | 4 +- .../estop/classicladder-estop-ui.py | 2 +- tests/hal-backslash/expected | 2 +- tests/hal-link-unlink/hallink.py | 8 +- tests/hal-show/expected | 120 +-- tests/hal-show/test.hal | 70 +- .../personalities_mod/4count_2pers.expected | 196 ++--- .../personalities_mod/4names_2pers.expected | 196 ++--- tests/halmodule.3/expected | 60 -- .../comp-set-get}/README | 0 .../comp-set-get}/expected | 6 +- .../comp-set-get}/test.py | 24 +- .../comp-set-get}/test.sh | 0 tests/halmodule/deprecated/deprecated.py | 18 + tests/halmodule/deprecated/expected | 12 + tests/halmodule/deprecated/test.sh | 2 + tests/halmodule/halquery/expected | 60 ++ .../halquery}/halquerytest.py | 12 +- .../halquery}/test.hal | 0 .../no-comp-needed}/expected | 0 .../no-comp-needed}/halmodtest.py | 0 .../no-comp-needed}/test.hal | 0 .../stream}/expected | 0 .../stream}/stream_reader.py | 0 .../stream}/stream_test.py | 0 .../stream}/stream_writer.py | 0 .../stream}/test.hal | 0 tests/halui/jogging/test-ui.py | 64 +- tests/halui/mdi/test-ui.py | 24 +- tests/hard-limits/test-ui.py | 2 +- tests/io-startup/test-ui.py | 2 +- tests/limit3/constraints/test.hal | 22 +- tests/mb2hal/mb2hal.1b/expected | 48 +- tests/mb2hal/mb2hal.2b/expected | 96 +- tests/mdi-queue-length/test-ui.py | 4 +- tests/motion-logger/basic/test-ui.py | 2 +- tests/motion/jogwheel-axis/test-ui.py | 28 +- tests/motion/jogwheel-joint/test-ui.py | 28 +- tests/mux/expected | 68 +- tests/mux/test.hal | 70 +- tests/pyvcp/expected | 48 +- tests/raster/rastertest.py | 32 +- tests/remap/remap-io/test-ui.py | 8 +- tests/save.0/expected | 10 +- tests/single-step/test-ui.py | 8 +- tests/tlo/test-ui.py | 2 +- tests/tool-info/non-random/test-ui.py | 14 +- .../random-no-startup-tool/test-ui.py | 14 +- .../random-with-startup-tool/test-ui.py | 14 +- tests/toolchanger/m61/test-ui.py | 16 +- .../reload-tool/non-random/test-ui.py | 16 +- .../toolchanger/reload-tool/random/test-ui.py | 16 +- 422 files changed, 4272 insertions(+), 5409 deletions(-) delete mode 100644 src/emc/usr_intf/axis/scripts/haltest.py delete mode 100644 src/hal/components/abs_s32.comp rename src/hal/components/{abs_s64.comp => abs_sint.comp} (94%) create mode 100644 src/hal/components/conv_real_bool.comp rename src/hal/components/{scaled_s32_sums.comp => scaled_sint_sums.comp} (72%) delete mode 100644 tests/halmodule.3/expected rename tests/{halmodule.0 => halmodule/comp-set-get}/README (100%) rename tests/{halmodule.0 => halmodule/comp-set-get}/expected (94%) rename tests/{halmodule.0 => halmodule/comp-set-get}/test.py (75%) rename tests/{halmodule.0 => halmodule/comp-set-get}/test.sh (100%) create mode 100755 tests/halmodule/deprecated/deprecated.py create mode 100644 tests/halmodule/deprecated/expected create mode 100755 tests/halmodule/deprecated/test.sh create mode 100644 tests/halmodule/halquery/expected rename tests/{halmodule.3 => halmodule/halquery}/halquerytest.py (90%) rename tests/{halmodule.3 => halmodule/halquery}/test.hal (100%) rename tests/{halmodule.2 => halmodule/no-comp-needed}/expected (100%) rename tests/{halmodule.2 => halmodule/no-comp-needed}/halmodtest.py (100%) rename tests/{halmodule.2 => halmodule/no-comp-needed}/test.hal (100%) rename tests/{halmodule.1 => halmodule/stream}/expected (100%) rename tests/{halmodule.1 => halmodule/stream}/stream_reader.py (100%) rename tests/{halmodule.1 => halmodule/stream}/stream_test.py (100%) rename tests/{halmodule.1 => halmodule/stream}/stream_writer.py (100%) rename tests/{halmodule.1 => halmodule/stream}/test.hal (100%) diff --git a/configs/apps/gladevcp/class-callback/class_callback.py b/configs/apps/gladevcp/class-callback/class_callback.py index b0b6c2156d5..1be1e711b9d 100644 --- a/configs/apps/gladevcp/class-callback/class_callback.py +++ b/configs/apps/gladevcp/class-callback/class_callback.py @@ -65,7 +65,7 @@ def __init__(self, halcomp,builder,useropts): self.halcomp = halcomp self.builder = builder - self.halcomp.newpin("value", hal.HAL_FLOAT, hal.HAL_OUT) + self.halcomp.newpin("value", hal.Type.REAL, hal.Dir.OUT) self.start = time.time() self.nhits = 0 self.ticks = 0 diff --git a/configs/apps/gladevcp/complex/complex.py b/configs/apps/gladevcp/complex/complex.py index 67b2693f69b..98dd9a449af 100644 --- a/configs/apps/gladevcp/complex/complex.py +++ b/configs/apps/gladevcp/complex/complex.py @@ -123,12 +123,12 @@ def _hal_setup(self,halcomp, builder): self.led1 = self.builder.get_object("hal_led1") # standard hal pins not associated with any widget - self.halcomp.newpin("example-out", hal.HAL_BIT, hal.HAL_OUT) - self.halcomp.newpin("example-in", hal.HAL_S32, hal.HAL_IN) + self.halcomp.newpin("example-out", hal.Type.BOOL, hal.Dir.OUT) + self.halcomp.newpin("example-in", hal.Type.SINT, hal.Dir.IN) # hal pins with change callback. Also unrelated to any HAL widget. # When the pin's value changes the callback is executed. - self.example_trigger = hal_glib.GPin(halcomp.newpin('example-trigger', hal.HAL_BIT, hal.HAL_IN)) + self.example_trigger = hal_glib.GPin(halcomp.newpin('example-trigger', hal.Type.BOOL, hal.Dir.IN)) self.example_trigger.connect('value-changed', self._on_example_trigger_change) def __init__(self, halcomp,builder,useropts): diff --git a/configs/attic/demo_mazak/demo_mazak.hal b/configs/attic/demo_mazak/demo_mazak.hal index 1992c48980a..cb75231ae98 100644 --- a/configs/attic/demo_mazak/demo_mazak.hal +++ b/configs/attic/demo_mazak/demo_mazak.hal @@ -91,7 +91,7 @@ loadrt modmath mod_dir=2 loadrt charge_pump loadrt tristate_bit loadrt tristate_float count=3 -loadrt conv_s32_float +loadrt conv_sint_real # Software encoder counter, for the jogwheel, and possibly a future # small manual encoder for a feedrate override knob. @@ -164,7 +164,7 @@ addf tristate-bit.0 servo-thread addf tristate-float.0 servo-thread addf tristate-float.1 servo-thread addf tristate-float.2 servo-thread -addf conv-s32-float.0 servo-thread +addf conv-sint-real.0 servo-thread # output drivers are loaded last addf motenc.3.dac-write servo-thread diff --git a/configs/attic/demo_mazak/tester.hal b/configs/attic/demo_mazak/tester.hal index 11e79330433..a19918f8ef4 100644 --- a/configs/attic/demo_mazak/tester.hal +++ b/configs/attic/demo_mazak/tester.hal @@ -75,45 +75,45 @@ quit # LEDs and/or switches to, included here for reference only # spindle related signals: "internal" signal -#newsig sp-index-enable bit -#newsig sp-orient-pos-ok bit -#newsig sp-engage-high-gear bit -#newsig sp-engage-low-gear bit -#newsig sp-in-high-gear bit -#newsig sp-in-low-gear bit -#newsig sp-in-neutral bit -#newsig sp-shifting bit -#newsig sp-at-speed bit +#newsig sp-index-enable bool +#newsig sp-orient-pos-ok bool +#newsig sp-engage-high-gear bool +#newsig sp-engage-low-gear bool +#newsig sp-in-high-gear bool +#newsig sp-in-low-gear bool +#newsig sp-in-neutral bool +#newsig sp-shifting bool +#newsig sp-at-speed bool # misc control # tool change location push button operators -#newsig worklight-pbs bit +#newsig worklight-pbs bool # add front panel buttons here # hydraulic pump -#newsig hydraulic-pump-run bit -#newsig hydraulic-pump-running bit +#newsig hydraulic-pump-run bool +#newsig hydraulic-pump-running bool # add a temporary signal to rotate by one. -#newsig forward-one bit +#newsig forward-one bool # hydraulic valves -#newsig arm-extend bit -#newsig arm-retract bit -#newsig arm-60cw bit -#newsig arm-180ccw bit -#newsig tool-load bit -#newsig tool-unload bit -#newsig magazine-forward bit -#newsig magazine-reverse bit -#newsig tool-unclamp bit -#newsig head-unclamp bit +#newsig arm-extend bool +#newsig arm-retract bool +#newsig arm-60cw bool +#newsig arm-180ccw bool +#newsig tool-load bool +#newsig tool-unload bool +#newsig magazine-forward bool +#newsig magazine-reverse bool +#newsig tool-unclamp bool +#newsig head-unclamp bool # other solenoids and such -#newsig spindle-air-blast bit -#newsig work-air-blast bit -#newsig mist-coolant bit -#newsig flood-coolant bit +#newsig spindle-air-blast bool +#newsig work-air-blast bool +#newsig mist-coolant bool +#newsig flood-coolant bool diff --git a/configs/attic/unclaimed/plasma-thc/mp1000A.hal b/configs/attic/unclaimed/plasma-thc/mp1000A.hal index c4935bdc3a5..59e72834910 100644 --- a/configs/attic/unclaimed/plasma-thc/mp1000A.hal +++ b/configs/attic/unclaimed/plasma-thc/mp1000A.hal @@ -16,7 +16,7 @@ loadrt or2 count=9 loadrt scale loadrt sum2 count=5 loadrt xor2 count=4 -loadrt conv_s32_float +loadrt conv_sint_real loadrt edge count=2 # Attach realtime hal components to a realtime thread @@ -32,7 +32,7 @@ addf and2.8 servo-thread addf comp.0 servo-thread addf comp.1 servo-thread addf comp.2 servo-thread -addf conv-s32-float.0 servo-thread +addf conv-sint-real.0 servo-thread addf edge.0 servo-thread addf edge.1 servo-thread addf flipflop.0 servo-thread @@ -178,8 +178,8 @@ net FeedHold xor2.0.out => motion.feed-hold net CHLSwitched xor2.2.out => and2.1.in1 net ArcOKTimer oneshot.2.out => xor2.1.in0 net PierceLatch flipflop.1.out => mux2.0.sel oneshot.0.in -net IgnitionCounterS32 updown.0.count => conv-s32-float.0.in -net IgnitionCounterFloat conv-s32-float.0.out => comp.2.in1 +net IgnitionCounterS32 updown.0.count => conv-sint-real.0.in +net IgnitionCounterFloat conv-sint-real.0.out => comp.2.in1 net IgnitionTimerOff oneshot.1.out-not => updown.0.countup net TorchOff not.2.out => flipflop.1.reset net TorchTurnedOffOrTimeout or2.7.out => or2.6.in1 diff --git a/configs/attic/unclaimed/plasma-thc/mp1000B.hal b/configs/attic/unclaimed/plasma-thc/mp1000B.hal index a65f06ebe11..94bfbbf2a10 100644 --- a/configs/attic/unclaimed/plasma-thc/mp1000B.hal +++ b/configs/attic/unclaimed/plasma-thc/mp1000B.hal @@ -16,7 +16,7 @@ loadrt or2 count=9 loadrt scale loadrt sum2 count=5 loadrt xor2 count=4 -loadrt conv_s32_float +loadrt conv_sint_real loadrt edge count=2 # Attach realtime hal components to a realtime thread @@ -32,7 +32,7 @@ addf and2.8 servo-thread addf comp.0 servo-thread addf comp.1 servo-thread addf comp.2 servo-thread -addf conv-s32-float.0 servo-thread +addf conv-sint-real.0 servo-thread addf edge.0 servo-thread addf edge.1 servo-thread addf flipflop.0 servo-thread @@ -178,8 +178,8 @@ net FeedHold xor2.0.out => motion.feed-hold net CHLSwitched xor2.2.out => and2.1.in1 net ArcOKTimer oneshot.2.out => xor2.1.in0 net PierceLatch flipflop.1.out => mux2.0.sel oneshot.0.in -net IgnitionCounterS32 updown.0.count => conv-s32-float.0.in -net IgnitionCounterFloat conv-s32-float.0.out => comp.2.in1 +net IgnitionCounterS32 updown.0.count => conv-sint-real.0.in +net IgnitionCounterFloat conv-sint-real.0.out => comp.2.in1 net IgnitionTimerOff oneshot.1.out-not => updown.0.countup net TorchOff not.2.out => flipflop.1.reset net TorchTurnedOffOrTimeout or2.7.out => or2.6.in1 diff --git a/configs/attic/unclaimed/plasma-thc/thc300.hal b/configs/attic/unclaimed/plasma-thc/thc300.hal index 8a3d838e509..37950d48b61 100644 --- a/configs/attic/unclaimed/plasma-thc/thc300.hal +++ b/configs/attic/unclaimed/plasma-thc/thc300.hal @@ -16,7 +16,7 @@ loadrt or2 count=9 loadrt scale loadrt sum2 count=5 loadrt xor2 count=4 -loadrt conv_s32_float +loadrt conv_sint_real loadrt edge count=2 # Attach realtime hal components to a realtime thread @@ -32,7 +32,7 @@ addf and2.8 servo-thread addf comp.0 servo-thread addf comp.1 servo-thread addf comp.2 servo-thread -addf conv-s32-float.0 servo-thread +addf conv-sint-real.0 servo-thread addf edge.0 servo-thread addf edge.1 servo-thread addf flipflop.0 servo-thread @@ -178,8 +178,8 @@ net FeedHold xor2.0.out => motion.feed-hold net CHLSwitched xor2.2.out => and2.1.in1 net ArcOKTimer oneshot.2.out => xor2.1.in0 net PierceLatch flipflop.1.out => mux2.0.sel oneshot.0.in -net IgnitionCounterS32 updown.0.count => conv-s32-float.0.in -net IgnitionCounterFloat conv-s32-float.0.out => comp.2.in1 +net IgnitionCounterS32 updown.0.count => conv-sint-real.0.in +net IgnitionCounterFloat conv-sint-real.0.out => comp.2.in1 net IgnitionTimerOff oneshot.1.out-not => updown.0.countup net TorchOff not.2.out => flipflop.1.reset net TorchTurnedOffOrTimeout or2.7.out => or2.6.in1 diff --git a/configs/by_interface/mesa/hm2-modbus/bldc_and_wavebox.mbccs b/configs/by_interface/mesa/hm2-modbus/bldc_and_wavebox.mbccs index 389e7818c71..60d8de8b2d5 100644 --- a/configs/by_interface/mesa/hm2-modbus/bldc_and_wavebox.mbccs +++ b/configs/by_interface/mesa/hm2-modbus/bldc_and_wavebox.mbccs @@ -58,9 +58,9 @@ diff --git a/configs/by_interface/mesa/hm2-modbus/hm2-stepper-eth-modbus.hal b/configs/by_interface/mesa/hm2-modbus/hm2-stepper-eth-modbus.hal index 6f3ce888c2f..d92213dbfe7 100644 --- a/configs/by_interface/mesa/hm2-modbus/hm2-stepper-eth-modbus.hal +++ b/configs/by_interface/mesa/hm2-modbus/hm2-stepper-eth-modbus.hal @@ -62,7 +62,7 @@ addf estop-latch.0 servo-thread # ################ # axis enable chain -newsig emcmot.00.enable bit +newsig emcmot.00.enable bool sets emcmot.00.enable FALSE net emcmot.00.enable <= joint.0.amp-enable-out @@ -97,7 +97,7 @@ setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.step_type 0 # ################ # axis enable chain -newsig emcmot.01.enable bit +newsig emcmot.01.enable bool sets emcmot.01.enable FALSE net emcmot.01.enable <= joint.1.amp-enable-out @@ -132,7 +132,7 @@ setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.step_type 0 # ################ # axis enable chain -newsig emcmot.02.enable bit +newsig emcmot.02.enable bool sets emcmot.02.enable FALSE net emcmot.02.enable <= joint.2.amp-enable-out diff --git a/configs/by_interface/mesa/hm2-modbus/rs485io.mbccs b/configs/by_interface/mesa/hm2-modbus/rs485io.mbccs index b34a5780fb5..f8777a01762 100644 --- a/configs/by_interface/mesa/hm2-modbus/rs485io.mbccs +++ b/configs/by_interface/mesa/hm2-modbus/rs485io.mbccs @@ -6,10 +6,10 @@ - - - - + + + + diff --git a/configs/by_interface/mesa/hm2-modbus/waveshare-modbus-rtu-relay-d.mbccs b/configs/by_interface/mesa/hm2-modbus/waveshare-modbus-rtu-relay-d.mbccs index e12e388402b..877180c15f0 100644 --- a/configs/by_interface/mesa/hm2-modbus/waveshare-modbus-rtu-relay-d.mbccs +++ b/configs/by_interface/mesa/hm2-modbus/waveshare-modbus-rtu-relay-d.mbccs @@ -41,9 +41,9 @@ diff --git a/configs/by_interface/mesa/hm2-servo/hm2-servo-eth.hal b/configs/by_interface/mesa/hm2-servo/hm2-servo-eth.hal index 0280e5a1397..480c630e49c 100644 --- a/configs/by_interface/mesa/hm2-servo/hm2-servo-eth.hal +++ b/configs/by_interface/mesa/hm2-servo/hm2-servo-eth.hal @@ -71,7 +71,7 @@ addf hm2_[HOSTMOT2](BOARD).0.write servo-thread # ################ # axis enable chain -newsig emcmot.00.enable bit +newsig emcmot.00.enable bool sets emcmot.00.enable FALSE net emcmot.00.enable => pid.0.enable net emcmot.00.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.enable @@ -112,7 +112,7 @@ net motor.00.command pid.0.output => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.value # ################ # axis enable chain -newsig emcmot.01.enable bit +newsig emcmot.01.enable bool sets emcmot.01.enable FALSE net emcmot.01.enable => pid.1.enable net emcmot.01.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.01.enable @@ -153,7 +153,7 @@ net motor.01.command pid.1.output => hm2_[HOSTMOT2](BOARD).0.pwmgen.01.value # ################ # axis enable chain -newsig emcmot.02.enable bit +newsig emcmot.02.enable bool sets emcmot.02.enable FALSE net emcmot.02.enable => pid.2.enable net emcmot.02.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.02.enable diff --git a/configs/by_interface/mesa/hm2-servo/hm2-servo.hal b/configs/by_interface/mesa/hm2-servo/hm2-servo.hal index 2280553301c..548e010854e 100644 --- a/configs/by_interface/mesa/hm2-servo/hm2-servo.hal +++ b/configs/by_interface/mesa/hm2-servo/hm2-servo.hal @@ -71,7 +71,7 @@ addf hm2_[HOSTMOT2](BOARD).0.write servo-thread # ################ # axis enable chain -newsig emcmot.00.enable bit +newsig emcmot.00.enable bool sets emcmot.00.enable FALSE net emcmot.00.enable => pid.0.enable net emcmot.00.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.enable @@ -112,7 +112,7 @@ net motor.00.command pid.0.output => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.value # ################ # axis enable chain -newsig emcmot.01.enable bit +newsig emcmot.01.enable bool sets emcmot.01.enable FALSE net emcmot.01.enable => pid.1.enable net emcmot.01.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.01.enable @@ -153,7 +153,7 @@ net motor.01.command pid.1.output => hm2_[HOSTMOT2](BOARD).0.pwmgen.01.value # ################ # axis enable chain -newsig emcmot.02.enable bit +newsig emcmot.02.enable bool sets emcmot.02.enable FALSE net emcmot.02.enable => pid.2.enable net emcmot.02.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.02.enable diff --git a/configs/by_interface/mesa/hm2-stepper/hm2-stepper-eth.hal b/configs/by_interface/mesa/hm2-stepper/hm2-stepper-eth.hal index fc190995168..2a8c5171a9c 100644 --- a/configs/by_interface/mesa/hm2-stepper/hm2-stepper-eth.hal +++ b/configs/by_interface/mesa/hm2-stepper/hm2-stepper-eth.hal @@ -62,7 +62,7 @@ addf estop-latch.0 servo-thread # ################ # axis enable chain -newsig emcmot.00.enable bit +newsig emcmot.00.enable bool sets emcmot.00.enable FALSE net emcmot.00.enable <= joint.0.amp-enable-out @@ -97,7 +97,7 @@ setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.step_type 0 # ################ # axis enable chain -newsig emcmot.01.enable bit +newsig emcmot.01.enable bool sets emcmot.01.enable FALSE net emcmot.01.enable <= joint.1.amp-enable-out @@ -132,7 +132,7 @@ setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.step_type 0 # ################ # axis enable chain -newsig emcmot.02.enable bit +newsig emcmot.02.enable bool sets emcmot.02.enable FALSE net emcmot.02.enable <= joint.2.amp-enable-out diff --git a/configs/by_interface/mesa/hm2-stepper/hm2-stepper-rpspi.hal b/configs/by_interface/mesa/hm2-stepper/hm2-stepper-rpspi.hal index 11fbef9dc88..8dc8cad1e32 100644 --- a/configs/by_interface/mesa/hm2-stepper/hm2-stepper-rpspi.hal +++ b/configs/by_interface/mesa/hm2-stepper/hm2-stepper-rpspi.hal @@ -62,7 +62,7 @@ addf estop-latch.0 servo-thread # ################ # axis enable chain -newsig emcmot.00.enable bit +newsig emcmot.00.enable bool sets emcmot.00.enable FALSE net emcmot.00.enable <= joint.0.amp-enable-out @@ -97,7 +97,7 @@ setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.step_type 0 # ################ # axis enable chain -newsig emcmot.01.enable bit +newsig emcmot.01.enable bool sets emcmot.01.enable FALSE net emcmot.01.enable <= joint.1.amp-enable-out @@ -132,7 +132,7 @@ setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.step_type 0 # ################ # axis enable chain -newsig emcmot.02.enable bit +newsig emcmot.02.enable bool sets emcmot.02.enable FALSE net emcmot.02.enable <= joint.2.amp-enable-out diff --git a/configs/by_interface/mesa/hm2-stepper/hm2-stepper.hal b/configs/by_interface/mesa/hm2-stepper/hm2-stepper.hal index b74ed0a1ec1..b8179f4b3f2 100644 --- a/configs/by_interface/mesa/hm2-stepper/hm2-stepper.hal +++ b/configs/by_interface/mesa/hm2-stepper/hm2-stepper.hal @@ -62,7 +62,7 @@ addf estop-latch.0 servo-thread # ################ # axis enable chain -newsig emcmot.00.enable bit +newsig emcmot.00.enable bool sets emcmot.00.enable FALSE net emcmot.00.enable <= joint.0.amp-enable-out @@ -97,7 +97,7 @@ setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.step_type 0 # ################ # axis enable chain -newsig emcmot.01.enable bit +newsig emcmot.01.enable bool sets emcmot.01.enable FALSE net emcmot.01.enable <= joint.1.amp-enable-out @@ -132,7 +132,7 @@ setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.step_type 0 # ################ # axis enable chain -newsig emcmot.02.enable bit +newsig emcmot.02.enable bool sets emcmot.02.enable FALSE net emcmot.02.enable <= joint.2.amp-enable-out diff --git a/configs/by_interface/mesa/plasma-5i20/plasma-5i20.hal b/configs/by_interface/mesa/plasma-5i20/plasma-5i20.hal index 38d703f7a0e..13a6de0db10 100644 --- a/configs/by_interface/mesa/plasma-5i20/plasma-5i20.hal +++ b/configs/by_interface/mesa/plasma-5i20/plasma-5i20.hal @@ -47,7 +47,7 @@ addf parport.0.write servo-thread # X [0] Axis # axis enable chain -newsig emcmot.00.enable bit +newsig emcmot.00.enable bool sets emcmot.00.enable FALSE net emcmot.00.enable <= joint.0.amp-enable-out @@ -86,7 +86,7 @@ net both-home-x => joint.0.pos-lim-sw-in # ################ # axis enable chain -newsig emcmot.01.enable bit +newsig emcmot.01.enable bool sets emcmot.01.enable FALSE net emcmot.01.enable <= joint.1.amp-enable-out @@ -125,7 +125,7 @@ net both-home-y => joint.1.pos-lim-sw-in # ################ # axis enable chain -newsig emcmot.02.enable bit +newsig emcmot.02.enable bool sets emcmot.02.enable FALSE net emcmot.02.enable <= joint.2.amp-enable-out diff --git a/configs/by_interface/parport/plasma-thc-sim/thc.hal b/configs/by_interface/parport/plasma-thc-sim/thc.hal index d7c397a38e7..6b644223cc6 100644 --- a/configs/by_interface/parport/plasma-thc-sim/thc.hal +++ b/configs/by_interface/parport/plasma-thc-sim/thc.hal @@ -19,7 +19,7 @@ loadrt or2 count=10 loadrt scale loadrt sum2 count=5 loadrt xor2 count=4 -loadrt conv_s32_float +loadrt conv_sint_real loadrt edge count=2 # Attach realtime hal components to a realtime thread @@ -35,7 +35,7 @@ addf and2.8 servo-thread addf comp.0 servo-thread addf comp.1 servo-thread addf comp.2 servo-thread -addf conv-s32-float.0 servo-thread +addf conv-sint-real.0 servo-thread addf edge.0 servo-thread addf edge.1 servo-thread addf flipflop.0 servo-thread @@ -186,8 +186,8 @@ net FeedHold xor2.0.out => motion.feed-hold net CHLSwitched xor2.2.out => and2.1.in1 net ArcOKTimer oneshot.2.out => xor2.1.in0 net PierceLatch flipflop.1.out => mux2.0.sel oneshot.0.in -net IgnitionCounterS32 updown.0.count => conv-s32-float.0.in -net IgnitionCounterFloat conv-s32-float.0.out => comp.2.in1 +net IgnitionCounterS32 updown.0.count => conv-sint-real.0.in +net IgnitionCounterFloat conv-sint-real.0.out => comp.2.in1 net IgnitionTimerOff oneshot.1.out-not => updown.0.countup net TorchOff not.2.out => flipflop.1.reset net TorchTurnedOffOrTimeout or2.7.out => or2.6.in1 diff --git a/configs/by_interface/pico/USC_encod/univstep_io.hal b/configs/by_interface/pico/USC_encod/univstep_io.hal index 73eadc15c2f..4c9ba134e8d 100644 --- a/configs/by_interface/pico/USC_encod/univstep_io.hal +++ b/configs/by_interface/pico/USC_encod/univstep_io.hal @@ -35,9 +35,9 @@ net Ahome => joint.3.home-sw-in # connect index pulses to motion controller # uncomment these lines only if you have a Rev 2 USC board -#newsig Xindex bit -#newsig Yindex bit -#newsig Zindex bit +#newsig Xindex bool +#newsig Yindex bool +#newsig Zindex bool #linksp Xindex <= ppmc.0.encoder.00.index-enable #linksp Xindex => joint.0.index-enable #linksp Yindex <= ppmc.0.encoder.01.index-enable diff --git a/configs/by_interface/pico/ppmc/ppmc_io.hal b/configs/by_interface/pico/ppmc/ppmc_io.hal index 5ab44000a3d..81f39c3d1d6 100644 --- a/configs/by_interface/pico/ppmc/ppmc_io.hal +++ b/configs/by_interface/pico/ppmc/ppmc_io.hal @@ -63,8 +63,8 @@ net emc-estop-out estop-latch.0.ok-in net emc-estop-reset iocontrol.0.user-request-enable net emc-estop-reset estop-latch.0.reset -#newsig EstopSense bit -#newsig EstopWrite bit +#newsig EstopSense bool +#newsig EstopWrite bool #linksp EstopSense <= ppmc.0.din.estop.in-not #linksp EstopSense => iocontrol.0.emc-enable-in #linksp EstopWrite <= ppmc.0.dout.07.out diff --git a/configs/by_interface/pico/univpwm/univpwm_io.hal b/configs/by_interface/pico/univpwm/univpwm_io.hal index e6aefb6a601..bbfd49ba8eb 100644 --- a/configs/by_interface/pico/univpwm/univpwm_io.hal +++ b/configs/by_interface/pico/univpwm/univpwm_io.hal @@ -37,9 +37,9 @@ net Ahome => joint.3.home-sw-in # uncomment these lines only if you have a Rev 3 UPC board # The ppmc.x.encoder.xx.index-enable pin is ONLY exported by the driver # if the UPC has rev 3 or above firmware -#newsig Xindex bit -#newsig Yindex bit -#newsig Zindex bit +#newsig Xindex bool +#newsig Yindex bool +#newsig Zindex bool #linksp Xindex <= ppmc.0.encoder.00.index-enable #linksp Xindex => joint.0.index-enable #linksp Yindex <= ppmc.0.encoder.01.index-enable diff --git a/configs/by_interface/pico/univpwmv/univpwm_io.hal b/configs/by_interface/pico/univpwmv/univpwm_io.hal index c7d55248797..dc533439aef 100644 --- a/configs/by_interface/pico/univpwmv/univpwm_io.hal +++ b/configs/by_interface/pico/univpwmv/univpwm_io.hal @@ -4,9 +4,9 @@ # # connect limit/home switch outputs to motion controller -newsig Xminlim bit -newsig Xmaxlim bit -newsig Xhome bit +newsig Xminlim bool +newsig Xmaxlim bool +newsig Xhome bool linksp Xminlim <= ppmc.0.din.01.in linksp Xminlim => joint.0.neg-lim-sw-in linksp Xmaxlim <= ppmc.0.din.02.in @@ -14,9 +14,9 @@ linksp Xmaxlim => joint.0.pos-lim-sw-in linksp Xhome <= ppmc.0.din.00.in linksp Xhome => joint.0.home-sw-in -newsig Yminlim bit -newsig Ymaxlim bit -newsig Yhome bit +newsig Yminlim bool +newsig Ymaxlim bool +newsig Yhome bool #linksp Yminlim <= ppmc.0.din.05.in #linksp Yminlim => joint.1.neg-lim-sw-in #linksp Ymaxlim <= ppmc.0.din.06.in @@ -24,9 +24,9 @@ newsig Yhome bit #linksp Yhome <= ppmc.0.din.04.in #linksp Yhome => joint.1.home-sw-in -newsig Zminlim bit -newsig Zmaxlim bit -newsig Zhome bit +newsig Zminlim bool +newsig Zmaxlim bool +newsig Zhome bool #linksp Zminlim <= ppmc.0.din.09.in #linksp Zminlim => joint.2.neg-lim-sw-in #linksp Zmaxlim <= ppmc.0.din.10.in @@ -34,9 +34,9 @@ newsig Zhome bit #linksp Zhome <= ppmc.0.din.08.in #linksp Zhome => joint.2.home-sw-in -newsig Aminlim bit -newsig Amaxlim bit -newsig Ahome bit +newsig Aminlim bool +newsig Amaxlim bool +newsig Ahome bool linksp Aminlim <= ppmc.0.din.12.in linksp Aminlim => joint.3.neg-lim-sw-in linksp Amaxlim <= ppmc.0.din.13.in @@ -47,9 +47,9 @@ linksp Ahome => joint.3.home-sw-in # connect index pulses to motion controller # do these when index pulsing is figured out -newsig Xindex bit -newsig Yindex bit -newsig Zindex bit +newsig Xindex bool +newsig Yindex bool +newsig Zindex bool linksp Xindex <= ppmc.0.encoder.00.index-enable linksp Xindex => joint.0.index-enable linksp Yindex <= ppmc.0.encoder.01.index-enable @@ -64,48 +64,48 @@ linksp Zindex => joint.2.index-enable # connect e-stop write/sense to I/O controller # and univpwm's fault with estop's output, so estop FF is reset, but # prevent continued estop signal from univpwm from holding FF cleared -newsig ppmcEstop bit +newsig ppmcEstop bool linksp ppmcEstop ppmc.0.din.15.in-not linksp ppmcEstop and2.0.in0 -newsig EstopOkIn bit +newsig EstopOkIn bool linksp EstopOkIn estop-latch.0.fault-in linksp EstopOkIn and2.0.out -newsig EstopOkOut bit +newsig EstopOkOut bool linksp EstopOkOut <= ppmc.0.dout.07.out linksp EstopOkOut iocontrol.0.emc-enable-in linksp EstopOkOut estop-latch.0.ok-out linksp EstopOkOut and2.0.in1 -newsig emc-estop-out bit +newsig emc-estop-out bool linksp emc-estop-out iocontrol.0.user-enable-out linksp emc-estop-out estop-latch.0.ok-in -newsig emc-estop-reset bit +newsig emc-estop-reset bool linksp emc-estop-reset iocontrol.0.user-request-enable linksp emc-estop-reset estop-latch.0.reset # connect spindle fwd/rev to I/O controller -newsig SpindleFwd bit -newsig SpindleRev bit +newsig SpindleFwd bool +newsig SpindleRev bool linksp SpindleFwd <= ppmc.0.dout.00.out linksp SpindleFwd => spindle.0.forward linksp SpindleRev <= ppmc.0.dout.01.out linksp SpindleRev => spindle.0.reverse # connect spindle speed up/down to I/O controller -newsig SpindleUp bit -newsig SpindleDown bit +newsig SpindleUp bool +newsig SpindleDown bool #linksp SpindleUp <= ppmc.0.dout.06.out #linksp SpindleUp => motion.spindle-incr-speed #linksp SpindleDown <= ppmc.0.dout.05.out #linksp SpindleDown => motion.spindle-decr-speed # connect spindle brake to I/O controller -newsig SpindleBrakeOn bit +newsig SpindleBrakeOn bool linksp SpindleBrakeOn <= ppmc.0.dout.02.out linksp SpindleBrakeOn => spindle.0.brake # connect mist/flood coolant to I/O controller -newsig MistOn bit -newsig FloodOn bit +newsig MistOn bool +newsig FloodOn bool linksp MistOn <= ppmc.0.dout.03.out linksp MistOn => iocontrol.0.coolant-mist linksp FloodOn <= ppmc.0.dout.04.out diff --git a/configs/by_interface/pico/univpwmv/univpwm_load.hal b/configs/by_interface/pico/univpwmv/univpwm_load.hal index 524a756c062..01c926ed99c 100644 --- a/configs/by_interface/pico/univpwmv/univpwm_load.hal +++ b/configs/by_interface/pico/univpwmv/univpwm_load.hal @@ -30,7 +30,7 @@ loadrt not count=1 loadrt estop_latch count=1 loadrt and2 count=1 loadrt or2 count=1 -loadrt conv_s32_float count=1 +loadrt conv_sint_real count=1 loadrt mult2 count=2 loadrt lowpass count=1 @@ -50,7 +50,7 @@ addf pid.2.do-pid-calcs servo-thread addf pid.3.do-pid-calcs servo-thread # for spindle addf or2.0 servo-thread -addf conv-s32-float.0 servo-thread +addf conv-sint-real.0 servo-thread addf mult2.0 servo-thread addf mult2.1 servo-thread addf lowpass.0 servo-thread diff --git a/configs/by_interface/pico/univpwmv/univpwm_motion.hal b/configs/by_interface/pico/univpwmv/univpwm_motion.hal index ed22221f505..3ed10fa10ab 100644 --- a/configs/by_interface/pico/univpwmv/univpwm_motion.hal +++ b/configs/by_interface/pico/univpwmv/univpwm_motion.hal @@ -60,22 +60,22 @@ setp ppmc.0.pwm.02.scale [JOINT_2]OUTPUT_SCALE linkps ddt.0.in Xoutput linkps ddt.1.in Xpos-fb -newsig spindle-sync bit -newsig spindle-index-en bit +newsig spindle-sync bool +newsig spindle-index-en bool linksp spindle-index-en => ppmc.0.encoder.03.index-enable # hook up motion controller's sync output linkps spindle.0.index-enable => spindle-index-en # report rev count to motion controller -newsig spindle-pos float +newsig spindle-pos real linkps ppmc.0.encoder.03.position => spindle-pos linksp spindle-pos => spindle.0.revs # set up 4th PWM generator as a spindle speed control -newsig spindle-speed float -newsig spindle-pwm-cmd float -newsig spindle-pwm-filt float +newsig spindle-speed real +newsig spindle-pwm-cmd real +newsig spindle-pwm-filt real linkps spindle.0.speed-out => spindle-speed linksp spindle-speed => mult2.1.in0 setp mult2.1.in1 0.0009018 @@ -85,15 +85,15 @@ linkps lowpass.0.out => spindle-pwm-filt linksp spindle-pwm-filt => ppmc.0.pwm.03.value setp lowpass.0.gain 0.005 -newsig spindle-enable bit +newsig spindle-enable bool # SpindleFwd and SpindleRev come from univpwm_io.hal linksp SpindleFwd => or2.0.in0 linksp SpindleRev => or2.0.in1 linkps or2.0.out => spindle-enable linksp spindle-enable ppmc.0.pwm.03.enable # spindle speed display -net spinraw ppmc.0.encoder.03.delta conv-s32-float.0.in -net spinfloat conv-s32-float.0.out mult2.0.in0 +net spinraw ppmc.0.encoder.03.delta conv-sint-real.0.in +net spinfloat conv-sint-real.0.out mult2.0.in0 setp mult2.0.in1 8.6805555 -newsig SpindleRPM float -linkps mult2.0.out => SpindleRPM \ No newline at end of file +newsig SpindleRPM real +linkps mult2.0.out => SpindleRPM diff --git a/configs/by_interface/pico/univpwmv/univpwm_servo.hal b/configs/by_interface/pico/univpwmv/univpwm_servo.hal index fb39ef07ed0..959054630e3 100644 --- a/configs/by_interface/pico/univpwmv/univpwm_servo.hal +++ b/configs/by_interface/pico/univpwmv/univpwm_servo.hal @@ -2,9 +2,9 @@ # for a full four axis setup # create four position feedback signals -newsig Xpos-fb float -newsig Ypos-fb float -newsig Zpos-fb float +newsig Xpos-fb real +newsig Ypos-fb real +newsig Zpos-fb real # connect position feedback to PID loop linksp Xpos-fb => pid.0.feedback @@ -17,9 +17,9 @@ linksp Ypos-fb => joint.1.motor-pos-fb linksp Zpos-fb => joint.2.motor-pos-fb # create PID to DAC output signals -newsig Xoutput float -newsig Youtput float -newsig Zoutput float +newsig Xoutput real +newsig Youtput real +newsig Zoutput real # connect output signals to output of PID loops linksp Xoutput <= pid.0.output @@ -60,9 +60,9 @@ setp pid.2.FF2 [JOINT_2]FF2 setp pid.2.deadband [JOINT_2]DEADBAND # create four position command signals -newsig Xpos-cmd float -newsig Ypos-cmd float -newsig Zpos-cmd float +newsig Xpos-cmd real +newsig Ypos-cmd real +newsig Zpos-cmd real # connect position commands to motion controller linksp Xpos-cmd <= joint.0.motor-pos-cmd @@ -74,10 +74,10 @@ linksp Xpos-cmd => pid.0.command linksp Ypos-cmd => pid.1.command linksp Zpos-cmd => pid.2.command -# create bit signals to enable/disable the PID loops -newsig Xenable bit -newsig Yenable bit -newsig Zenable bit +# create bool signals to enable/disable the PID loops +newsig Xenable bool +newsig Yenable bool +newsig Zenable bool # connect the signals to the motion controller linksp Xenable <= joint.0.amp-enable-out diff --git a/configs/by_interface/pico/univstep/univstep_io.hal b/configs/by_interface/pico/univstep/univstep_io.hal index 73eadc15c2f..4c9ba134e8d 100644 --- a/configs/by_interface/pico/univstep/univstep_io.hal +++ b/configs/by_interface/pico/univstep/univstep_io.hal @@ -35,9 +35,9 @@ net Ahome => joint.3.home-sw-in # connect index pulses to motion controller # uncomment these lines only if you have a Rev 2 USC board -#newsig Xindex bit -#newsig Yindex bit -#newsig Zindex bit +#newsig Xindex bool +#newsig Yindex bool +#newsig Zindex bool #linksp Xindex <= ppmc.0.encoder.00.index-enable #linksp Xindex => joint.0.index-enable #linksp Yindex <= ppmc.0.encoder.01.index-enable diff --git a/configs/by_interface/servotogo/stg_io.hal b/configs/by_interface/servotogo/stg_io.hal index 64cea5cc34f..86b639d81f9 100644 --- a/configs/by_interface/servotogo/stg_io.hal +++ b/configs/by_interface/servotogo/stg_io.hal @@ -51,9 +51,9 @@ net Zfault => joint.2.amp-fault-in # connect index pulses to motion controller # do these when index pulsing is figured out -#newsig Xindex bit -#newsig Yindex bit -#newsig Zindex bit +#newsig Xindex bool +#newsig Yindex bool +#newsig Zindex bool #linksp Xindex <= stg.0.enc-index #linksp Xindex => joint.0.index-enable #linksp Yindex <= stg.1.enc-index @@ -68,7 +68,7 @@ net Zenable => stg.out-02 # connect watchdog reset to motion controller # needs watchdo -#newsig WatchdogRst bit +#newsig WatchdogRst bool #linksp WatchdogRst <= stg.watchdog-reset #linksp WatchdogRst => motion.watchdog-reset-out diff --git a/configs/by_interface/vigilant/vti_io.hal b/configs/by_interface/vigilant/vti_io.hal index b3c9213aeb1..c1a1303d6c0 100644 --- a/configs/by_interface/vigilant/vti_io.hal +++ b/configs/by_interface/vigilant/vti_io.hal @@ -18,9 +18,9 @@ addf vti.do-write servo-thread -1 # # connect limit/home switch outputs to motion controller -#newsig Xminlim bit -#newsig Xmaxlim bit -#newsig Xhome bit +#newsig Xminlim bool +#newsig Xmaxlim bool +#newsig Xhome bool #linksp Xminlim <= vti.in-02 #linksp Xminlim => joint.0.neg-lim-sw-in #linksp Xmaxlim <= vti.in-01 @@ -28,9 +28,9 @@ addf vti.do-write servo-thread -1 #linksp Xhome <= vti.in-00 #linksp Xhome => joint.0.home-sw-in -#newsig Yminlim bit -#newsig Ymaxlim bit -#newsig Yhome bit +#newsig Yminlim bool +#newsig Ymaxlim bool +#newsig Yhome bool #linksp Yminlim <= vti.in-06 #linksp Yminlim => joint.1.neg-lim-sw-in #linksp Ymaxlim <= vti.in-05 @@ -38,9 +38,9 @@ addf vti.do-write servo-thread -1 #linksp Yhome <= vti.in-04 #linksp Yhome => joint.1.home-sw-in -#newsig Zminlim bit -#newsig Zmaxlim bit -#newsig Zhome bit +#newsig Zminlim bool +#newsig Zmaxlim bool +#newsig Zhome bool #linksp Zminlim <= vti.in-10 #linksp Zminlim => joint.2.neg-lim-sw-in #linksp Zmaxlim <= vti.in-09 @@ -51,9 +51,9 @@ addf vti.do-write servo-thread -1 #continue in the same manner for further axes (A,B,C) # connect amp faults to motion controller -#newsig Xfault bit -#newsig Yfault bit -#newsig Zfault bit +#newsig Xfault bool +#newsig Yfault bool +#newsig Zfault bool #linksp Xfault <= vti.in-03 #linksp Xfault => joint.0.amp-fault-in #linksp Yfault <= vti.in-07 @@ -63,9 +63,9 @@ addf vti.do-write servo-thread -1 # connect index pulses to motion controller # do these when index pulsing is figured out -#newsig Xindex bit -#newsig Yindex bit -#newsig Zindex bit +#newsig Xindex bool +#newsig Yindex bool +#newsig Zindex bool #linksp Xindex <= vti.0.enc-index #linksp Xindex => joint.0.index-enable #linksp Yindex <= vti.1.enc-index @@ -80,7 +80,7 @@ addf vti.do-write servo-thread -1 # connect watchdog reset to motion controller # needs watchdo -#newsig WatchdogRst bit +#newsig WatchdogRst bool #linksp WatchdogRst <= vti.watchdog-reset #linksp WatchdogRst => motion.watchdog-reset-out @@ -92,8 +92,8 @@ addf vti.do-write servo-thread -1 # connect e-stop write/sense to I/O controller # these connections assume an external ESTOP circuitry will be used # if it's not used, comment the next lines and uncomment the loopback -#newsig EstopSense bit -#newsig EstopWrite bit +#newsig EstopSense bool +#newsig EstopWrite bool #linksp EstopSense <= vti.in-12 #linksp EstopSense => iocontrol.0.emc-enable-in #linksp EstopWrite <= vti.out-07 @@ -104,21 +104,21 @@ addf vti.do-write servo-thread -1 #net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in # connect spindle fwd/rev to I/O controller -#newsig SpindleFwd bit -#newsig SpindleRev bit +#newsig SpindleFwd bool +#newsig SpindleRev bool #linksp SpindleFwd <= vti.out-06 #linksp SpindleFwd => spindle.0.forward #linksp SpindleRev <= vti.out-05 #linksp SpindleRev => spindle.0.reverse # connect spindle brake to I/O controller -#newsig SpindleBrakeOn bit +#newsig SpindleBrakeOn bool #linksp SpindleBrakeOn <= vti.out-10 #linksp SpindleBrakeOn => spindle.0.brake # connect mist/flood coolant to I/O controller -#newsig MistOn bit -#newsig FloodOn bit +#newsig MistOn bool +#newsig FloodOn bool #linksp MistOn <= vti.out-11 #linksp MistOn => iocontrol.0.coolant-mist #linksp FloodOn <= vti.out-12 diff --git a/configs/by_interface/vitalsystems/motenc_io.hal b/configs/by_interface/vitalsystems/motenc_io.hal index 6ed452bc5a7..9937a9ef757 100644 --- a/configs/by_interface/vitalsystems/motenc_io.hal +++ b/configs/by_interface/vitalsystems/motenc_io.hal @@ -62,7 +62,7 @@ net Yenable => motenc.0.out-09 net Zenable => motenc.0.out-10 # Connect watchdog reset to motion controller. -#newsig WatchdogRst bit +#newsig WatchdogRst bool #linksp WatchdogRst <= motenc.watchdog-reset #linksp WatchdogRst => motion.watchdog-reset-out diff --git a/configs/by_machine/scorbot-er-3/pyvcp.xml b/configs/by_machine/scorbot-er-3/pyvcp.xml index efc643fff0a..38af8ea7437 100644 --- a/configs/by_machine/scorbot-er-3/pyvcp.xml +++ b/configs/by_machine/scorbot-er-3/pyvcp.xml @@ -2,7 +2,7 @@ - + @@ -11,7 +11,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -48,7 +48,7 @@ - + diff --git a/configs/by_machine/sherline/Sherline4Axis/standard_pinout.hal b/configs/by_machine/sherline/Sherline4Axis/standard_pinout.hal index d2ff33247b4..658272be908 100644 --- a/configs/by_machine/sherline/Sherline4Axis/standard_pinout.hal +++ b/configs/by_machine/sherline/Sherline4Axis/standard_pinout.hal @@ -32,7 +32,7 @@ net estop-out => iocontrol.0.emc-enable-in #net ioctl-tool-change iocontrol.0.tool-change iocontrol.0.tool-changed # create a signal for "spindle on" -#newsig spindle_on bit +#newsig spindle_on bool # commented out till we resolve this issue # connect it to the iocontroller diff --git a/configs/by_machine/smithy/1240.hal b/configs/by_machine/smithy/1240.hal index 3246ce0ac1c..622f193fd20 100644 --- a/configs/by_machine/smithy/1240.hal +++ b/configs/by_machine/smithy/1240.hal @@ -33,7 +33,7 @@ net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed net tool-prepare-loopback iocontrol.0.tool-prepare iocontrol.0.tool-prepared #the Enable signal is used to permanently enable things -newsig Enable bit +newsig Enable bool sets Enable TRUE #configure the spindle speed diff --git a/configs/by_machine/smithy/1240_4axis.hal b/configs/by_machine/smithy/1240_4axis.hal index 0574c2cb554..d7b77e254de 100644 --- a/configs/by_machine/smithy/1240_4axis.hal +++ b/configs/by_machine/smithy/1240_4axis.hal @@ -33,7 +33,7 @@ net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed net tool-prepare-loopback iocontrol.0.tool-prepare iocontrol.0.tool-prepared #the Enable signal is used to permanently enable things -newsig Enable bit +newsig Enable bool sets Enable TRUE #configure the spindle speed diff --git a/configs/by_machine/smithy/1240gecko.hal b/configs/by_machine/smithy/1240gecko.hal index d9222d0d001..f4f1a6aca39 100644 --- a/configs/by_machine/smithy/1240gecko.hal +++ b/configs/by_machine/smithy/1240gecko.hal @@ -111,7 +111,7 @@ net apos-cmd joint.3.motor-pos-cmd stepgen.3.position-cmd net apos-fb stepgen.3.position-fb joint.3.motor-pos-fb net aenable joint.3.amp-enable-out stepgen.3.enable -newsig false bit +newsig false bool sets false FALSE net xhoming joint.0.homing match8.0.a0 net yhoming joint.1.homing match8.0.a1 diff --git a/configs/by_machine/smithy/1240rutex.hal b/configs/by_machine/smithy/1240rutex.hal index 3ba9e532bff..82ef5226dc2 100644 --- a/configs/by_machine/smithy/1240rutex.hal +++ b/configs/by_machine/smithy/1240rutex.hal @@ -65,7 +65,7 @@ net reverse spindle.0.reverse parport.0.pin-17-out net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed net tool-prepare-loopback iocontrol.0.tool-prepare iocontrol.0.tool-prepared -newsig false bit +newsig false bool sets false FALSE net xhoming joint.0.homing match8.0.a0 net yhoming joint.1.homing match8.0.a1 diff --git a/configs/by_machine/smithy/1240rutex_4axis.hal b/configs/by_machine/smithy/1240rutex_4axis.hal index 28b827b57a2..2b289e1b625 100644 --- a/configs/by_machine/smithy/1240rutex_4axis.hal +++ b/configs/by_machine/smithy/1240rutex_4axis.hal @@ -73,7 +73,7 @@ net reverse spindle.0.reverse parport.0.pin-17-out net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed net tool-prepare-loopback iocontrol.0.tool-prepare iocontrol.0.tool-prepared -newsig false bit +newsig false bool sets false FALSE net xhoming joint.0.homing match8.0.a0 net yhoming joint.1.homing match8.0.a1 diff --git a/configs/by_machine/smithy/516gecko.hal b/configs/by_machine/smithy/516gecko.hal index 2086d95174b..7824253f3f5 100644 --- a/configs/by_machine/smithy/516gecko.hal +++ b/configs/by_machine/smithy/516gecko.hal @@ -107,7 +107,7 @@ net apos-cmd axis.3.motor-pos-cmd stepgen.3.position-cmd net apos-fb stepgen.3.position-fb axis.3.motor-pos-fb net aenable axis.3.amp-enable-out stepgen.3.enable -newsig false bit +newsig false bool sets false FALSE net xhoming axis.0.homing match8.0.a0 net yhoming axis.1.homing match8.0.a1 diff --git a/configs/by_machine/smithy/622.hal b/configs/by_machine/smithy/622.hal index ffc5aae8881..8485b9f5058 100644 --- a/configs/by_machine/smithy/622.hal +++ b/configs/by_machine/smithy/622.hal @@ -25,7 +25,7 @@ net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed net tool-prepare-loopback iocontrol.0.tool-prepare iocontrol.0.tool-prepared #the Enable signal is used to permanently enable things -newsig Enable bit +newsig Enable bool sets Enable TRUE #configure the spindle speed diff --git a/configs/by_machine/smithy/622_4axis.hal b/configs/by_machine/smithy/622_4axis.hal index 0b4f8b888f1..11e841133b0 100644 --- a/configs/by_machine/smithy/622_4axis.hal +++ b/configs/by_machine/smithy/622_4axis.hal @@ -25,7 +25,7 @@ net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed net tool-prepare-loopback iocontrol.0.tool-prepare iocontrol.0.tool-prepared #the Enable signal is used to permanently enable things -newsig Enable bit +newsig Enable bool sets Enable TRUE #configure the spindle speed diff --git a/configs/by_machine/smithy/622gecko.hal b/configs/by_machine/smithy/622gecko.hal index 27826962af7..7a3fe5a2083 100644 --- a/configs/by_machine/smithy/622gecko.hal +++ b/configs/by_machine/smithy/622gecko.hal @@ -107,7 +107,7 @@ net apos-cmd joint.3.motor-pos-cmd stepgen.3.position-cmd net apos-fb stepgen.3.position-fb joint.3.motor-pos-fb net aenable joint.3.amp-enable-out stepgen.3.enable -newsig false bit +newsig false bool sets false FALSE net xhoming joint.0.homing match8.0.a0 net yhoming joint.1.homing match8.0.a1 diff --git a/configs/by_machine/smithy/622keyence.hal b/configs/by_machine/smithy/622keyence.hal index 3c0ae9ba53f..254580cc503 100644 --- a/configs/by_machine/smithy/622keyence.hal +++ b/configs/by_machine/smithy/622keyence.hal @@ -25,7 +25,7 @@ net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed net tool-prepare-loopback iocontrol.0.tool-prepare iocontrol.0.tool-prepared #the Enable signal is used to permanently enable things -newsig Enable bit +newsig Enable bool sets Enable TRUE #configure the spindle speed diff --git a/configs/by_machine/smithy/622leadshine.hal b/configs/by_machine/smithy/622leadshine.hal index 9b2e67def9d..e9636a4a4ee 100644 --- a/configs/by_machine/smithy/622leadshine.hal +++ b/configs/by_machine/smithy/622leadshine.hal @@ -25,7 +25,7 @@ net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed net tool-prepare-loopback iocontrol.0.tool-prepare iocontrol.0.tool-prepared #the Enable signal is used to permanently enable things -newsig Enable bit +newsig Enable bool sets Enable TRUE #configure the spindle speed diff --git a/configs/by_machine/smithy/622leadshine_4axis.hal b/configs/by_machine/smithy/622leadshine_4axis.hal index ca2cda33083..b66483daec6 100644 --- a/configs/by_machine/smithy/622leadshine_4axis.hal +++ b/configs/by_machine/smithy/622leadshine_4axis.hal @@ -25,7 +25,7 @@ net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed net tool-prepare-loopback iocontrol.0.tool-prepare iocontrol.0.tool-prepared #the Enable signal is used to permanently enable things -newsig Enable bit +newsig Enable bool sets Enable TRUE #configure the spindle speed diff --git a/configs/by_machine/smithy/924.hal b/configs/by_machine/smithy/924.hal index c40c14e3f3c..4fc5bab2148 100644 --- a/configs/by_machine/smithy/924.hal +++ b/configs/by_machine/smithy/924.hal @@ -30,7 +30,7 @@ loadrt charge_pump loadrt lowpass #the Enable signal is used to permanently enable things -newsig Enable bit +newsig Enable bool sets Enable TRUE #configure the spindle encoder diff --git a/configs/common/shuttle.hal b/configs/common/shuttle.hal index 14168bb5133..153748fe5ac 100644 --- a/configs/common/shuttle.hal +++ b/configs/common/shuttle.hal @@ -13,7 +13,7 @@ loadusr -W shuttle -loadrt abs_s32 names=abs_s32.sxp +loadrt abs_sint names=abs_sint.sxp loadrt select8 names=select8.sxp-jog-speed,select8.sxp-jog-increment loadrt mux2 names=mux2.sxp-x-analog,mux2.sxp-y-analog,mux2.sxp-z-analog loadrt updown names=updown.sxp @@ -45,7 +45,7 @@ net sxp.spring-wheel <= shuttlexpress.0.spring-wheel-s32 # deflection # -addf abs_s32.sxp servo-thread +addf abs_sint.sxp servo-thread addf select8.sxp-jog-speed servo-thread @@ -60,10 +60,10 @@ addf tristate-float.sxp7 servo-thread # get abs value & sign of spring-wheel -net sxp.spring-wheel => abs_s32.sxp.in -net sxp.spring-wheel-abs <= abs_s32.sxp.out -net sxp.spring-wheel-is-positive <= abs_s32.sxp.is-positive -net sxp.spring-wheel-is-negative <= abs_s32.sxp.is-negative +net sxp.spring-wheel => abs_sint.sxp.in +net sxp.spring-wheel-abs <= abs_sint.sxp.out +net sxp.spring-wheel-is-positive <= abs_sint.sxp.is-positive +net sxp.spring-wheel-is-negative <= abs_sint.sxp.is-negative # use abs value to select abs jog speed net sxp.spring-wheel-abs => select8.sxp-jog-speed.sel diff --git a/configs/sim/axis/external_offsets/dynamic_offsets_panel.hal b/configs/sim/axis/external_offsets/dynamic_offsets_panel.hal index 2595ac3d9dd..d8fb312d375 100644 --- a/configs/sim/axis/external_offsets/dynamic_offsets_panel.hal +++ b/configs/sim/axis/external_offsets/dynamic_offsets_panel.hal @@ -1,6 +1,6 @@ loadrt siggen names=gen loadrt scale names=scalea -loadrt conv_float_s32 names=cvt +loadrt conv_real_sint names=cvt loadrt not names=nota loadrt or2 names=or2a diff --git a/configs/sim/axis/gantry/gantry_panel.hal b/configs/sim/axis/gantry/gantry_panel.hal index cbc2d78412a..178ddd5e615 100644 --- a/configs/sim/axis/gantry/gantry_panel.hal +++ b/configs/sim/axis/gantry/gantry_panel.hal @@ -22,7 +22,7 @@ # factor (machine-units per count). loadrt mux2 names=home_sequence_mux,jjog_counts_mux -loadrt conv_float_s32 names=home_sequence_s32 +loadrt conv_real_sint names=home_sequence_sint loadrt oneshot names=pulse_on_jjdisable # synchronized homing, no joint1,3 jogging: @@ -46,15 +46,15 @@ setp pulse_on_jjdisable.width 0.1 addf home_sequence_mux servo-thread addf jjog_counts_mux servo-thread -addf home_sequence_s32 servo-thread +addf home_sequence_sint servo-thread addf pulse_on_jjdisable servo-thread net home_seq_float <= home_sequence_mux.out -net home_seq_float => home_sequence_s32.in +net home_seq_float => home_sequence_sint.in -net home_seq_s32 <= home_sequence_s32.out -net home_seq_s32 => ini.1.home_sequence -net home_seq_s32 => ini.3.home_sequence +net home_seq_sint <= home_sequence_sint.out +net home_seq_sint => ini.1.home_sequence +net home_seq_sint => ini.3.home_sequence # set counts to zero using param_pin upon disable: net jjog_counts_value <= jjog_counts_mux.out diff --git a/configs/sim/axis/gladevcp/meter_scale.py b/configs/sim/axis/gladevcp/meter_scale.py index dddd8d95708..f586ba50695 100644 --- a/configs/sim/axis/gladevcp/meter_scale.py +++ b/configs/sim/axis/gladevcp/meter_scale.py @@ -14,7 +14,7 @@ def __init__(self, halcomp,builder,useropts): # hal pin with change callback. # When the pin's value changes the callback is executed. - self.max_value = hal_glib.GPin(halcomp.newpin('max-value', hal.HAL_FLOAT, hal.HAL_IN)) + self.max_value = hal_glib.GPin(halcomp.newpin('max-value', hal.Type.REAL, hal.Dir.IN)) self.max_value.connect('value-changed', self._on_max_value_change) inifile = linuxcnc.ini(os.getenv("INI_FILE_NAME")) diff --git a/configs/sim/axis/laser/laser.hal b/configs/sim/axis/laser/laser.hal index b19bbb358ed..8d8bffe10bf 100644 --- a/configs/sim/axis/laser/laser.hal +++ b/configs/sim/axis/laser/laser.hal @@ -1,4 +1,4 @@ -loadrt conv_s32_u32 names=laser.motion.type-conv +loadrt conv_sint_uint names=laser.motion.type-conv loadrt bitslice names=laser.motion.type-slice personality=2 loadrt limit1 names=laser.power.min.limit,laser.power.max.limit,laser.power.cmd.limit loadrt laserpower names=laser.control diff --git a/configs/sim/axis/plasma/plasmac2/lib/conversational.py b/configs/sim/axis/plasma/plasmac2/lib/conversational.py index 5d340c0e60a..2814b3d774b 100644 --- a/configs/sim/axis/plasma/plasmac2/lib/conversational.py +++ b/configs/sim/axis/plasma/plasmac2/lib/conversational.py @@ -373,7 +373,7 @@ def send_pressed(self): def block_request(self): # may need to add this halpin for wcs rotation on abort etc. -# self.convBlockLoaded = self.h.newpin('conv_block_loaded', hal.HAL_BIT, hal.HAL_IN) +# self.convBlockLoaded = self.h.newpin('conv_block_loaded', hal.Type.BOOL, hal.Dir.IN) if not self.settingsExited: if self.previewActive and self.active_shape(): return True diff --git a/configs/sim/axis/plasma/plasmac2/lib/custom/user_hal.py b/configs/sim/axis/plasma/plasmac2/lib/custom/user_hal.py index 7798482d467..70e4c7d5c26 100644 --- a/configs/sim/axis/plasma/plasmac2/lib/custom/user_hal.py +++ b/configs/sim/axis/plasma/plasmac2/lib/custom/user_hal.py @@ -1,4 +1,4 @@ # CUSTOM HAL PINS, RUNS ONCE AT STARTUP # example hal pin named my-halpin -#comp.newpin('my-halpin', hal.HAL_FLOAT, hal.HAL_IN) +#comp.newpin('my-halpin', hal.Type.REAL, hal.Dir.IN) diff --git a/configs/sim/axis/plasma/plasmac2/lib/sim/sim_panel.py b/configs/sim/axis/plasma/plasmac2/lib/sim/sim_panel.py index e759a497fe9..a5ec946f9a7 100755 --- a/configs/sim/axis/plasma/plasmac2/lib/sim/sim_panel.py +++ b/configs/sim/axis/plasma/plasmac2/lib/sim/sim_panel.py @@ -133,7 +133,7 @@ def estop_pressed(event): I = linuxcnc.ini(S.ini_filename) # create new hal component H = hal.component('plasmac-sim') - H.newpin('z-position', hal.HAL_FLOAT, hal.HAL_IN) + H.newpin('z-position', hal.Type.REAL, hal.Dir.IN) H.ready() # disconnect any conflicting hal pins if hal.pin_has_writer('db_arc-ok.in'): diff --git a/configs/sim/axis/plasma/plasmac2/plasmac2.py b/configs/sim/axis/plasma/plasmac2/plasmac2.py index f9a71b2271b..6fab69da369 100644 --- a/configs/sim/axis/plasma/plasmac2/plasmac2.py +++ b/configs/sim/axis/plasma/plasmac2/plasmac2.py @@ -3503,17 +3503,17 @@ def ext_hal_create(): global extHalPins for pin in ['abort', 'power', 'run', 'pause', 'run-pause', 'touchoff', 'probe','pulse', 'frame-job']: - comp.newpin(f"ext.{pin}", hal.HAL_BIT, hal.HAL_IN) + comp.newpin(f"ext.{pin}", hal.Type.BOOL, hal.Dir.IN) extHalPins[pin] = {'state': False, 'last': False} # external pins for user button toggle and pulse for pin in range(3): - comp.newpin(f"ext.out_{pin}", hal.HAL_BIT, hal.HAL_OUT) + comp.newpin(f"ext.out_{pin}", hal.Type.BOOL, hal.Dir.OUT) # pins for pierce only offsets for pin in 'xy': - comp.newpin(f"{pin}-pierce-offset", hal.HAL_FLOAT, hal.HAL_OUT) + comp.newpin(f"{pin}-pierce-offset", hal.Type.REAL, hal.Dir.OUT) # pins for pierce coordinate extents for pin in ['x_min', 'y_min', 'x_max', 'y_max']: - comp.newpin(f"{pin}_pierce_extent", hal.HAL_FLOAT, hal.HAL_IN) + comp.newpin(f"{pin}_pierce_extent", hal.Type.REAL, hal.Dir.IN) # called every cycle by user_live_update def ext_hal_watch(): @@ -5674,33 +5674,33 @@ def user_hal_pins(): if firstRun == 'invalid': return # create new hal pins - comp.newpin('arc-voltage', hal.HAL_FLOAT, hal.HAL_IN) - comp.newpin('led-arc-ok', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('led-torch', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('led-thc-enabled', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('led-ohmic', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('led-float', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('led-breakaway', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('led-thc-active', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('led-up', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('led-down', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('led-corner-locked', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('led-void-locked', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('refresh', hal.HAL_S32, hal.HAL_IN) - comp.newpin('material-change-number', hal.HAL_S32, hal.HAL_IN) - comp.newpin('material-change', hal.HAL_S32, hal.HAL_IN) - comp.newpin('material-change-timeout', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('material-reload', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('material-temp', hal.HAL_S32, hal.HAL_IN) - comp.newpin('cut-type', hal.HAL_S32, hal.HAL_IN) - comp.newpin('thc-enable-out', hal.HAL_BIT, hal.HAL_OUT) - comp.newpin('program-is-idle', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('laser-on', hal.HAL_BIT, hal.HAL_OUT) - comp.newpin('preview-tab', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('development', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('conv-block-loaded', hal.HAL_BIT, hal.HAL_IN) - comp.newpin('offset-set-probe', hal.HAL_BIT, hal.HAL_OUT) - comp.newpin('offset-set-scribe', hal.HAL_BIT, hal.HAL_OUT) + comp.newpin('arc-voltage', hal.Type.REAL, hal.Dir.IN) + comp.newpin('led-arc-ok', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('led-torch', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('led-thc-enabled', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('led-ohmic', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('led-float', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('led-breakaway', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('led-thc-active', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('led-up', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('led-down', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('led-corner-locked', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('led-void-locked', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('refresh', hal.Type.SINT, hal.Dir.IN) + comp.newpin('material-change-number', hal.Type.SINT, hal.Dir.IN) + comp.newpin('material-change', hal.Type.SINT, hal.Dir.IN) + comp.newpin('material-change-timeout', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('material-reload', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('material-temp', hal.Type.SINT, hal.Dir.IN) + comp.newpin('cut-type', hal.Type.SINT, hal.Dir.IN) + comp.newpin('thc-enable-out', hal.Type.BOOL, hal.Dir.OUT) + comp.newpin('program-is-idle', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('laser-on', hal.Type.BOOL, hal.Dir.OUT) + comp.newpin('preview-tab', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('development', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('conv-block-loaded', hal.Type.BOOL, hal.Dir.IN) + comp.newpin('offset-set-probe', hal.Type.BOOL, hal.Dir.OUT) + comp.newpin('offset-set-scribe', hal.Type.BOOL, hal.Dir.OUT) ext_hal_create() # create some new signals and connect pins hal_data = [[0,'plasmac:arc-voltage-out','plasmac.arc-voltage-out','axisui.arc-voltage'],\ @@ -5722,9 +5722,9 @@ def user_hal_pins(): ] for line in hal_data: if line[0] < 7: - hal.new_sig(line[1],hal.HAL_FLOAT) + hal.new_sig(line[1],hal.Type.REAL) else: - hal.new_sig(line[1],hal.HAL_BIT) + hal.new_sig(line[1],hal.Type.BOOL) hal.connect(line[2],line[1]) hal.connect(line[3],line[1]) # connect pins to some existing signals diff --git a/configs/sim/axis/plasma/user_hal.py b/configs/sim/axis/plasma/user_hal.py index a4d708d39b8..8ce00e31a5d 100644 --- a/configs/sim/axis/plasma/user_hal.py +++ b/configs/sim/axis/plasma/user_hal.py @@ -2,5 +2,5 @@ # see the file customizing.html for some tips # example to create a HAL floating point input pin and a HAL bit input pin -#comp.newpin('my-halfloat', hal.HAL_FLOAT, hal.HAL_IN) -#comp.newpin('my-halbit', hal.HAL_BIT, hal.HAL_IN) +#comp.newpin('my-halfloat', hal.Type.REAL, hal.Dir.IN) +#comp.newpin('my-halbit', hal.Type.BOOL, hal.Dir.IN) diff --git a/configs/sim/axis/remap/manual-toolchange-with-tool-length-switch/python/gladevcp-handler.py b/configs/sim/axis/remap/manual-toolchange-with-tool-length-switch/python/gladevcp-handler.py index 29441e50478..6f006bced42 100644 --- a/configs/sim/axis/remap/manual-toolchange-with-tool-length-switch/python/gladevcp-handler.py +++ b/configs/sim/axis/remap/manual-toolchange-with-tool-length-switch/python/gladevcp-handler.py @@ -19,7 +19,7 @@ def on_led_change(self,hal_led,data=None): def __init__(self, halcomp,builder,useropts): self.halcomp = halcomp self.change_text = builder.get_object("change-text") - self.halcomp.newpin("number", hal.HAL_FLOAT, hal.HAL_IN) + self.halcomp.newpin("number", hal.Type.REAL, hal.Dir.IN) def get_handlers(halcomp,builder,useropts): return [HandlerClass(halcomp,builder,useropts)] diff --git a/configs/sim/axis/vismach/3axis-tutorial/3axis-tutorial b/configs/sim/axis/vismach/3axis-tutorial/3axis-tutorial index 2b374b9bd12..1e349eb2947 100755 --- a/configs/sim/axis/vismach/3axis-tutorial/3axis-tutorial +++ b/configs/sim/axis/vismach/3axis-tutorial/3axis-tutorial @@ -24,13 +24,13 @@ s.poll() # in this file, and uncomment last line in HAL file. # add joints. Mill has 3. c = hal.component("3axis-tutorial") -c.newpin("jointX", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jointY", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jointZ", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("jointX", hal.Type.REAL, hal.Dir.IN) +c.newpin("jointY", hal.Type.REAL, hal.Dir.IN) +c.newpin("jointZ", hal.Type.REAL, hal.Dir.IN) # tool length and diameter pins? -c.newpin("toollength", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tooldiameter", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("toollength", hal.Type.REAL, hal.Dir.IN) +c.newpin("tooldiameter", hal.Type.REAL, hal.Dir.IN) # tells loadusr pins is ready c.ready() diff --git a/configs/sim/axis/vismach/5axis/bridgemill/5axisgui.py b/configs/sim/axis/vismach/5axis/bridgemill/5axisgui.py index 40fc0475126..5c70b420ce2 100755 --- a/configs/sim/axis/vismach/5axis/bridgemill/5axisgui.py +++ b/configs/sim/axis/vismach/5axis/bridgemill/5axisgui.py @@ -45,14 +45,14 @@ def coords(self): return -self.comp.tool_length, r, 0, r c = hal.component("5axisgui") -c.newpin("jx", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jy", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jz", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jb", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jc", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool_length", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool_diam", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("pivot_len", hal.HAL_FLOAT, hal.HAL_OUT) +c.newpin("jx", hal.Type.REAL, hal.Dir.IN) +c.newpin("jy", hal.Type.REAL, hal.Dir.IN) +c.newpin("jz", hal.Type.REAL, hal.Dir.IN) +c.newpin("jb", hal.Type.REAL, hal.Dir.IN) +c.newpin("jc", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool_length", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool_diam", hal.Type.REAL, hal.Dir.IN) +c.newpin("pivot_len", hal.Type.REAL, hal.Dir.OUT) c["pivot_len"] = pivot_len c.ready() diff --git a/configs/sim/axis/vismach/5axis/max5/max5gui.py b/configs/sim/axis/vismach/5axis/max5/max5gui.py index 23c92cf2ef3..8200145565e 100755 --- a/configs/sim/axis/vismach/5axis/max5/max5gui.py +++ b/configs/sim/axis/vismach/5axis/max5/max5gui.py @@ -37,18 +37,18 @@ def coords(self): c = hal.component("max5gui") # table -c.newpin("table", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("table", hal.Type.REAL, hal.Dir.IN) # saddle -c.newpin("saddle", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("saddle", hal.Type.REAL, hal.Dir.IN) # head vertical slide -c.newpin("head", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("head", hal.Type.REAL, hal.Dir.IN) # head tilt -c.newpin("tilt", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tilt", hal.Type.REAL, hal.Dir.IN) # rotary table -c.newpin("rotate", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotate", hal.Type.REAL, hal.Dir.IN) -c.newpin("tool-length", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool-radius", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tool-length", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool-radius", hal.Type.REAL, hal.Dir.IN) c.ready() pivot_len=100 diff --git a/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr-gui.py b/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr-gui.py index 21f55a2bdd6..2f27c07f8f2 100644 --- a/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr-gui.py +++ b/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr-gui.py @@ -33,26 +33,26 @@ c = hal.component("xyzab-tdr-gui") # axis-x -c.newpin("axis-x", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("axis-x", hal.Type.REAL, hal.Dir.IN) # axis-y -c.newpin("axis-y", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("axis-y", hal.Type.REAL, hal.Dir.IN) # axis-z -c.newpin("axis-z", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("axis-z", hal.Type.REAL, hal.Dir.IN) # rotary_a -c.newpin("rotary-a", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotary-a", hal.Type.REAL, hal.Dir.IN) # rotary_b -c.newpin("rotary-b", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotary-b", hal.Type.REAL, hal.Dir.IN) # geometric offsets between A and B axes -c.newpin("x_offset", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("z_offset", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("x_offset", hal.Type.REAL, hal.Dir.IN) +c.newpin("z_offset", hal.Type.REAL, hal.Dir.IN) # rot-point offsets -c.newpin("x-rot-point", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("y-rot-point", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("z-rot-point", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("x-rot-point", hal.Type.REAL, hal.Dir.IN) +c.newpin("y-rot-point", hal.Type.REAL, hal.Dir.IN) +c.newpin("z-rot-point", hal.Type.REAL, hal.Dir.IN) # tool-length offset # tool offsets -c.newpin("tool_length", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool_diameter", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tool_length", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool_diameter", hal.Type.REAL, hal.Dir.IN) c.ready() # These values are arbitrary and are meant to simulate an absolute diff --git a/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt-gui.py b/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt-gui.py index 98f267355d1..2283299ea80 100755 --- a/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt-gui.py +++ b/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt-gui.py @@ -30,19 +30,19 @@ c = hal.component("xyzac-trt-gui") # table-x -c.newpin("table-x", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("table-x", hal.Type.REAL, hal.Dir.IN) # saddle-y -c.newpin("saddle-y", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("saddle-y", hal.Type.REAL, hal.Dir.IN) # head vertical slide -c.newpin("spindle-z", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("spindle-z", hal.Type.REAL, hal.Dir.IN) # table-x tilt-b -c.newpin("tilt-a", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tilt-a", hal.Type.REAL, hal.Dir.IN) # rotary table-x -c.newpin("rotate-c", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotate-c", hal.Type.REAL, hal.Dir.IN) # offsets -c.newpin("y-offset", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("z-offset", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool-offset", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("y-offset", hal.Type.REAL, hal.Dir.IN) +c.newpin("z-offset", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool-offset", hal.Type.REAL, hal.Dir.IN) c.ready() for setting in sys.argv[1:]: exec(setting) diff --git a/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt-gui.py b/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt-gui.py index 5a652511b38..725cdd29fbd 100755 --- a/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt-gui.py +++ b/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt-gui.py @@ -30,18 +30,18 @@ c = hal.component("xyzbc-trt-gui") # table-x -c.newpin("table-x", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("table-x", hal.Type.REAL, hal.Dir.IN) # saddle-y -c.newpin("saddle-y", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("saddle-y", hal.Type.REAL, hal.Dir.IN) # head vertical slide -c.newpin("spindle-z", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("spindle-z", hal.Type.REAL, hal.Dir.IN) # table-x tilt-b -c.newpin("tilt-b", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tilt-b", hal.Type.REAL, hal.Dir.IN) # rotary table-x -c.newpin("rotate-c", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("z-offset", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("x-offset", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool-offset", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotate-c", hal.Type.REAL, hal.Dir.IN) +c.newpin("z-offset", hal.Type.REAL, hal.Dir.IN) +c.newpin("x-offset", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool-offset", hal.Type.REAL, hal.Dir.IN) c.ready() for setting in sys.argv[1:]: exec(setting) diff --git a/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/python/twp-helper-comp.py b/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/python/twp-helper-comp.py index e2139aab13a..44748312c4e 100755 --- a/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/python/twp-helper-comp.py +++ b/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/python/twp-helper-comp.py @@ -7,40 +7,40 @@ # this pin reflects the machine.analog pin used for the # twp-status -h.newpin("twp-status", hal.HAL_FLOAT, hal.HAL_IN) +h.newpin("twp-status", hal.Type.REAL, hal.Dir.IN) # these pins are created here from 'twp-status'' -h.newpin("twp-is-redefined", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("twp-is-defined", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("twp-is-active", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("twp-is-redefined", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("twp-is-defined", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("twp-is-active", hal.Type.BOOL, hal.Dir.OUT) # twp origin vector -h.newpin("twp-ox-in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("twp-oy-in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("twp-oz-in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("twp-ox", hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin("twp-oy", hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin("twp-oz", hal.HAL_FLOAT, hal.HAL_OUT) +h.newpin("twp-ox-in", hal.Type.REAL, hal.Dir.IN) +h.newpin("twp-oy-in", hal.Type.REAL, hal.Dir.IN) +h.newpin("twp-oz-in", hal.Type.REAL, hal.Dir.IN) +h.newpin("twp-ox", hal.Type.REAL, hal.Dir.OUT) +h.newpin("twp-oy", hal.Type.REAL, hal.Dir.OUT) +h.newpin("twp-oz", hal.Type.REAL, hal.Dir.OUT) # twp x-orientation vector -h.newpin("twp-xx-in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("twp-xy-in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("twp-xz-in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("twp-xx", hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin("twp-xy", hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin("twp-xz", hal.HAL_FLOAT, hal.HAL_OUT) +h.newpin("twp-xx-in", hal.Type.REAL, hal.Dir.IN) +h.newpin("twp-xy-in", hal.Type.REAL, hal.Dir.IN) +h.newpin("twp-xz-in", hal.Type.REAL, hal.Dir.IN) +h.newpin("twp-xx", hal.Type.REAL, hal.Dir.OUT) +h.newpin("twp-xy", hal.Type.REAL, hal.Dir.OUT) +h.newpin("twp-xz", hal.Type.REAL, hal.Dir.OUT) # twp z-orientation vector -h.newpin("twp-zx-in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("twp-zy-in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("twp-zz-in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("twp-zx", hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin("twp-zy", hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin("twp-zz", hal.HAL_FLOAT, hal.HAL_OUT) +h.newpin("twp-zx-in", hal.Type.REAL, hal.Dir.IN) +h.newpin("twp-zy-in", hal.Type.REAL, hal.Dir.IN) +h.newpin("twp-zz-in", hal.Type.REAL, hal.Dir.IN) +h.newpin("twp-zx", hal.Type.REAL, hal.Dir.OUT) +h.newpin("twp-zy", hal.Type.REAL, hal.Dir.OUT) +h.newpin("twp-zz", hal.Type.REAL, hal.Dir.OUT) # twp origin vector in machine coordinate system -h.newpin("twp-ox-world-in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("twp-oy-world-in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("twp-oz-world-in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("twp-ox-world", hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin("twp-oy-world", hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin("twp-oz-world", hal.HAL_FLOAT, hal.HAL_OUT) +h.newpin("twp-ox-world-in", hal.Type.REAL, hal.Dir.IN) +h.newpin("twp-oy-world-in", hal.Type.REAL, hal.Dir.IN) +h.newpin("twp-oz-world-in", hal.Type.REAL, hal.Dir.IN) +h.newpin("twp-ox-world", hal.Type.REAL, hal.Dir.OUT) +h.newpin("twp-oy-world", hal.Type.REAL, hal.Dir.OUT) +h.newpin("twp-oz-world", hal.Type.REAL, hal.Dir.OUT) h.ready() diff --git a/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/vismach/xyzacb-trsrn-gui.py b/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/vismach/xyzacb-trsrn-gui.py index 89720d695da..1209d973693 100755 --- a/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/vismach/xyzacb-trsrn-gui.py +++ b/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/vismach/xyzacb-trsrn-gui.py @@ -43,61 +43,61 @@ c = hal.component("xyzacb-trsrn-gui") # axis_x -c.newpin("axis_x", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("axis_x", hal.Type.REAL, hal.Dir.IN) # axis_y -c.newpin("axis_y", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("axis_y", hal.Type.REAL, hal.Dir.IN) # head vertical slide -c.newpin("axis_z", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("axis_z", hal.Type.REAL, hal.Dir.IN) # rotary_a -c.newpin("rotary_a", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotary_a", hal.Type.REAL, hal.Dir.IN) # rotary_b -c.newpin("rotary_b", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotary_b", hal.Type.REAL, hal.Dir.IN) # rotary_c -c.newpin("rotary_c", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotary_c", hal.Type.REAL, hal.Dir.IN) # nutation-angle -c.newpin("nutation_angle", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("nutation_angle", hal.Type.REAL, hal.Dir.IN) # tool offsets -c.newpin("tool_length", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool_diameter", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tool_length", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool_diameter", hal.Type.REAL, hal.Dir.IN) # geometric offsets in the spindle-rotary-assembly -c.newpin("pivot_y", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("pivot_z", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("offset_x", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("offset_y", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("pivot_y", hal.Type.REAL, hal.Dir.IN) +c.newpin("pivot_z", hal.Type.REAL, hal.Dir.IN) +c.newpin("offset_x", hal.Type.REAL, hal.Dir.IN) +c.newpin("offset_y", hal.Type.REAL, hal.Dir.IN) # rot-point offsets distances from pivot point ( spindle AB) # to rotation axis ( table C) -c.newpin("rot_axis_y", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("rot_axis_z", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rot_axis_y", hal.Type.REAL, hal.Dir.IN) +c.newpin("rot_axis_z", hal.Type.REAL, hal.Dir.IN) # selected kinematics -c.newpin("kinstype_select", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("kinstype_select", hal.Type.REAL, hal.Dir.IN) # work piece show/hide -c.newpin("hide_work_piece_1", hal.HAL_BIT, hal.HAL_IN) +c.newpin("hide_work_piece_1", hal.Type.BOOL, hal.Dir.IN) # spindle body show/hide -c.newpin("hide_spindle_body", hal.HAL_BIT, hal.HAL_IN) +c.newpin("hide_spindle_body", hal.Type.BOOL, hal.Dir.IN) # work piece show/hide -c.newpin("hide_somethingelse", hal.HAL_BIT, hal.HAL_IN) +c.newpin("hide_somethingelse", hal.Type.BOOL, hal.Dir.IN) # scale coordinate system indicators -c.newpin("scale_coords", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("scale_coords", hal.Type.REAL, hal.Dir.IN) # twp pins -c.newpin("twp_status", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_defined", hal.HAL_BIT, hal.HAL_IN) -c.newpin("twp_active", hal.HAL_BIT, hal.HAL_IN) +c.newpin("twp_status", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_defined", hal.Type.BOOL, hal.Dir.IN) +c.newpin("twp_active", hal.Type.BOOL, hal.Dir.IN) # the origin of the twp plane display needs to be independent of the work offsets # because those offsets change as the kinematic switches between world and tool -c.newpin("twp_ox_world", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_oy_world", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_oz_world", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("twp_ox_world", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_oy_world", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_oz_world", hal.Type.REAL, hal.Dir.IN) # origin of the twp -c.newpin("twp_ox", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_oy", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_oz", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("twp_ox", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_oy", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_oz", hal.Type.REAL, hal.Dir.IN) # normal vector defining the temporary work plane as set by user with G68.2 -c.newpin("twp_zx", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_zy", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_zz", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_xx", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_xy", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_xz", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("twp_zx", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_zy", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_zz", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_xx", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_xy", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_xz", hal.Type.REAL, hal.Dir.IN) c.ready() diff --git a/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/vismach/xyzbca-trsrn-gui.py b/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/vismach/xyzbca-trsrn-gui.py index 1c54ddbd1b2..871c0aa6921 100755 --- a/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/vismach/xyzbca-trsrn-gui.py +++ b/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/vismach/xyzbca-trsrn-gui.py @@ -42,61 +42,61 @@ c = hal.component("xyzbca-trsrn-gui") # axis_x -c.newpin("axis_x", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("axis_x", hal.Type.REAL, hal.Dir.IN) # axis_y -c.newpin("axis_y", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("axis_y", hal.Type.REAL, hal.Dir.IN) # head vertical slide -c.newpin("axis_z", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("axis_z", hal.Type.REAL, hal.Dir.IN) # rotary_a -c.newpin("rotary_a", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotary_a", hal.Type.REAL, hal.Dir.IN) # rotary_b -c.newpin("rotary_b", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotary_b", hal.Type.REAL, hal.Dir.IN) # rotary_c -c.newpin("rotary_c", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotary_c", hal.Type.REAL, hal.Dir.IN) # nutation-angle -c.newpin("nutation_angle", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("nutation_angle", hal.Type.REAL, hal.Dir.IN) # tool offsets -c.newpin("tool_length", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool_diameter", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tool_length", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool_diameter", hal.Type.REAL, hal.Dir.IN) # geometric offsets in the spindle-rotary-assembly -c.newpin("pivot_x", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("pivot_z", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("offset_x", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("offset_y", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("pivot_x", hal.Type.REAL, hal.Dir.IN) +c.newpin("pivot_z", hal.Type.REAL, hal.Dir.IN) +c.newpin("offset_x", hal.Type.REAL, hal.Dir.IN) +c.newpin("offset_y", hal.Type.REAL, hal.Dir.IN) # rot-point offsets distances from pivot point ( spindle AB) # to rotation axis ( table C) -c.newpin("rot_axis_x", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("rot_axis_z", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rot_axis_x", hal.Type.REAL, hal.Dir.IN) +c.newpin("rot_axis_z", hal.Type.REAL, hal.Dir.IN) # selected kinematics -c.newpin("kinstype_select", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("kinstype_select", hal.Type.REAL, hal.Dir.IN) # work piece show/hide -c.newpin("hide_work_piece_1", hal.HAL_BIT, hal.HAL_IN) +c.newpin("hide_work_piece_1", hal.Type.BOOL, hal.Dir.IN) # spindle body show/hide -c.newpin("hide_spindle_body", hal.HAL_BIT, hal.HAL_IN) +c.newpin("hide_spindle_body", hal.Type.BOOL, hal.Dir.IN) # work piece show/hide -c.newpin("hide_somethingelse", hal.HAL_BIT, hal.HAL_IN) +c.newpin("hide_somethingelse", hal.Type.BOOL, hal.Dir.IN) # scale coordinate system indicators -c.newpin("scale_coords", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("scale_coords", hal.Type.REAL, hal.Dir.IN) # twp pins -c.newpin("twp_status", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_defined", hal.HAL_BIT, hal.HAL_IN) -c.newpin("twp_active", hal.HAL_BIT, hal.HAL_IN) +c.newpin("twp_status", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_defined", hal.Type.BOOL, hal.Dir.IN) +c.newpin("twp_active", hal.Type.BOOL, hal.Dir.IN) # the origin of the twp plane display needs to be independent of the work offsets # because those offsets change as the kinematic switches between world and tool -c.newpin("twp_ox_world", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_oy_world", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_oz_world", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("twp_ox_world", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_oy_world", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_oz_world", hal.Type.REAL, hal.Dir.IN) # origin of the twp -c.newpin("twp_ox", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_oy", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_oz", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("twp_ox", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_oy", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_oz", hal.Type.REAL, hal.Dir.IN) # normal vector defining the temporary work plane as set by user with G68.2 -c.newpin("twp_zx", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_zy", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_zz", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_xx", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_xy", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("twp_xz", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("twp_zx", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_zy", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_zz", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_xx", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_xy", hal.Type.REAL, hal.Dir.IN) +c.newpin("twp_xz", hal.Type.REAL, hal.Dir.IN) c.ready() diff --git a/configs/sim/axis/vismach/VMC_toolchange/sim_vmc.hal b/configs/sim/axis/vismach/VMC_toolchange/sim_vmc.hal index 5c20572f0dc..46b5ccbc628 100644 --- a/configs/sim/axis/vismach/VMC_toolchange/sim_vmc.hal +++ b/configs/sim/axis/vismach/VMC_toolchange/sim_vmc.hal @@ -59,12 +59,12 @@ setp carlim.maxv 0.01 net car-vel carlim.in net car-vel-lim carlim.out carpos.in0 net car-pos carpos.out carpos.in1 vmcgui.carousel -loadrt conv_float_u32 -addf conv-float-u32.0 servo-thread -net car-pos conv-float-u32.0.in +loadrt conv_real_uint +addf conv-real-uint.0 servo-thread +net car-pos conv-real-uint.0.in loadrt bin2gray addf bin2gray.0 servo-thread -net sim-pocket-u conv-float-u32.0.out bin2gray.0.in +net sim-pocket-u conv-real-uint.0.out bin2gray.0.in loadrt bitslice personality=5 addf bitslice.0 servo-thread net graycode bin2gray.0.out bitslice.0.in @@ -76,29 +76,29 @@ net bit3 bitslice.0.out-03 net bit4 bitslice.0.out-04 # pulse and index output variant (untidy modmaths) -loadrt conv_s32_float count=2 -loadrt conv_float_s32 count=3 +loadrt conv_sint_real count=2 +loadrt conv_real_sint count=3 loadrt near count=3 loadrt scale -addf conv-s32-float.0 servo-thread -addf conv-float-s32.0 servo-thread -addf conv-s32-float.1 servo-thread -addf conv-float-s32.1 servo-thread +addf conv-sint-real.0 servo-thread +addf conv-real-sint.0 servo-thread +addf conv-sint-real.1 servo-thread +addf conv-real-sint.1 servo-thread addf scale.0 servo-thread addf near.1 servo-thread addf near.2 servo-thread -net car-pos conv-float-s32.0.in -net car-pos-int conv-float-s32.0.out conv-s32-float.0.in -net car-pos-float conv-s32-float.0.out near.1.in2 +net car-pos conv-real-sint.0.in +net car-pos-int conv-real-sint.0.out conv-sint-real.0.in +net car-pos-float conv-sint-real.0.out near.1.in2 net car-pos near.1.in1 net pulse near.1.out setp near.1.difference 0.01 setp scale.0.gain 0.1 setp scale.0.offset -1 # to show-off index homing net car-pos scale.0.in -net car-pos-div10 scale.0.out conv-float-s32.1.in -net car-pos-div10-int conv-float-s32.1.out conv-s32-float.1.in -net car-pos-div10-float conv-s32-float.1.out near.2.in2 +net car-pos-div10 scale.0.out conv-real-sint.1.in +net car-pos-div10-int conv-real-sint.1.out conv-sint-real.1.in +net car-pos-div10-float conv-sint-real.1.out near.2.in2 net car-pos-div10 near.2.in1 net index near.2.out setp near.2.difference 0.009 diff --git a/configs/sim/axis/vismach/VMC_toolchange/toolchange_gray.hal b/configs/sim/axis/vismach/VMC_toolchange/toolchange_gray.hal index bcd57e38856..5d49eccfe67 100644 --- a/configs/sim/axis/vismach/VMC_toolchange/toolchange_gray.hal +++ b/configs/sim/axis/vismach/VMC_toolchange/toolchange_gray.hal @@ -1,14 +1,14 @@ loadrt carousel pockets=10 dir=1 encoding=gray num_sense=4 -#loadrt conv_float_s32 (Already loaded in sim_vmc.hal) +#loadrt conv_real_sint (Already loaded in sim_vmc.hal) addf carousel.0 servo-thread -addf conv-float-s32.2 servo-thread # G-code analogue outputs are float-type +addf conv-real-sint.2 servo-thread # G-code analogue outputs are float-type setp carousel.0.fwd-dc 0.002 net car-enable motion.digital-out-00 carousel.0.enable net car-ready carousel.0.ready motion.digital-in-00 net car-vel carousel.0.motor-vel -net car-pos-req motion.analog-out-00 conv-float-s32.2.in -net car-pos-s32 conv-float-s32.2.out carousel.0.pocket-number +net car-pos-req motion.analog-out-00 conv-real-sint.2.in +net car-pos-s32 conv-real-sint.2.out carousel.0.pocket-number net bit0 carousel.0.sense-0 net bit1 carousel.0.sense-1 net bit2 carousel.0.sense-2 diff --git a/configs/sim/axis/vismach/VMC_toolchange/toolchange_index.hal b/configs/sim/axis/vismach/VMC_toolchange/toolchange_index.hal index fe22f8d054c..013f637c185 100644 --- a/configs/sim/axis/vismach/VMC_toolchange/toolchange_index.hal +++ b/configs/sim/axis/vismach/VMC_toolchange/toolchange_index.hal @@ -1,7 +1,7 @@ loadrt carousel pockets=10 dir=2 encoding=index -#loadrt conv_float_s32 (already loaded in sim_vmc.hal) +#loadrt conv_real_sint (already loaded in sim_vmc.hal) addf carousel.0 servo-thread -addf conv-float-s32.2 servo-thread # G-code analogue outputs are float-type +addf conv-real-sint.2 servo-thread # G-code analogue outputs are float-type setp carousel.0.fwd-dc 0.002 setp carousel.0.rev-dc -0.002 @@ -10,8 +10,8 @@ setp carousel.0.align-dc 0.0001 net car-enable motion.digital-out-00 carousel.0.enable net car-ready carousel.0.ready motion.digital-in-00 net car-vel carousel.0.motor-vel -net car-pos-req motion.analog-out-00 conv-float-s32.2.in -net car-pos-s32 conv-float-s32.2.out carousel.0.pocket-number +net car-pos-req motion.analog-out-00 conv-real-sint.2.in +net car-pos-s32 conv-real-sint.2.out carousel.0.pocket-number net index carousel.0.sense-0 net pulse carousel.0.sense-1 diff --git a/configs/sim/axis/vismach/VMC_toolchange/vmcgui b/configs/sim/axis/vismach/VMC_toolchange/vmcgui index 1344cfc1ac1..a471d96e66c 100755 --- a/configs/sim/axis/vismach/VMC_toolchange/vmcgui +++ b/configs/sim/axis/vismach/VMC_toolchange/vmcgui @@ -19,14 +19,14 @@ from vismach import * import hal c = hal.component("vmcgui") -c.newpin("X", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("Y", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("Z", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("arm", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("carousel", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("spindle", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("drawbar", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("lock", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("X", hal.Type.REAL, hal.Dir.IN) +c.newpin("Y", hal.Type.REAL, hal.Dir.IN) +c.newpin("Z", hal.Type.REAL, hal.Dir.IN) +c.newpin("arm", hal.Type.REAL, hal.Dir.IN) +c.newpin("carousel", hal.Type.REAL, hal.Dir.IN) +c.newpin("spindle", hal.Type.REAL, hal.Dir.IN) +c.newpin("drawbar", hal.Type.REAL, hal.Dir.IN) +c.newpin("lock", hal.Type.REAL, hal.Dir.IN) c.ready() diff --git a/configs/sim/axis/vismach/delta/lineardelta.py b/configs/sim/axis/vismach/delta/lineardelta.py index d8116b1a895..82b27967400 100755 --- a/configs/sim/axis/vismach/delta/lineardelta.py +++ b/configs/sim/axis/vismach/delta/lineardelta.py @@ -26,12 +26,12 @@ for setting in sys.argv[1:]: exec(setting) c = hal.component("lineardelta") -c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("R", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("L", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint0", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint3", hal.Type.REAL, hal.Dir.IN) +c.newpin("R", hal.Type.REAL, hal.Dir.IN) +c.newpin("L", hal.Type.REAL, hal.Dir.IN) c['R'], c['L'] = lineardeltakins.get_geometry() c.ready() diff --git a/configs/sim/axis/vismach/delta/rotarydelta.py b/configs/sim/axis/vismach/delta/rotarydelta.py index 36d5088f584..b6032be6613 100755 --- a/configs/sim/axis/vismach/delta/rotarydelta.py +++ b/configs/sim/axis/vismach/delta/rotarydelta.py @@ -25,13 +25,13 @@ for setting in sys.argv[1:]: exec(setting) c = hal.component("rotarydelta") -c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("pfr", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tl", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("sl", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("fr", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint0", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("pfr", hal.Type.REAL, hal.Dir.IN) +c.newpin("tl", hal.Type.REAL, hal.Dir.IN) +c.newpin("sl", hal.Type.REAL, hal.Dir.IN) +c.newpin("fr", hal.Type.REAL, hal.Dir.IN) c['pfr'], c['tl'], c['sl'], c['fr'] = rotarydeltakins.get_geometry() c.ready() diff --git a/configs/sim/axis/vismach/hbm/hbmgui.py b/configs/sim/axis/vismach/hbm/hbmgui.py index f79862940fa..9d0592d9252 100755 --- a/configs/sim/axis/vismach/hbm/hbmgui.py +++ b/configs/sim/axis/vismach/hbm/hbmgui.py @@ -42,13 +42,13 @@ def coords(self): c = hal.component("hbmgui") # HAL pins -c.newpin("table", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("saddle", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("head", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("quill", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("table", hal.Type.REAL, hal.Dir.IN) +c.newpin("saddle", hal.Type.REAL, hal.Dir.IN) +c.newpin("head", hal.Type.REAL, hal.Dir.IN) +c.newpin("quill", hal.Type.REAL, hal.Dir.IN) -c.newpin("tool-length", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool-radius", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tool-length", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool-radius", hal.Type.REAL, hal.Dir.IN) c.ready() tool_radius=0.5 diff --git a/configs/sim/axis/vismach/hexapod-sim/hexagui.py b/configs/sim/axis/vismach/hexapod-sim/hexagui.py index 82ce7717fcd..3ab256bff5f 100755 --- a/configs/sim/axis/vismach/hexapod-sim/hexagui.py +++ b/configs/sim/axis/vismach/hexapod-sim/hexagui.py @@ -19,20 +19,20 @@ #if(randomize): compname += str(random.randrange(0,10000)) c = hal.component(compname) #declare hal pins here -c.newpin("joint.0", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint.1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint.2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint.3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint.4", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint.5", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint.0", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint.1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint.2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint.3", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint.4", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint.5", hal.Type.REAL, hal.Dir.IN) #get the tool tip position in cartesian coordinates from emc #so we dont have to do kinematics -c.newpin("axis.x", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis.y", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis.z", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis.a", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis.b", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis.c", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("axis.x", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis.y", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis.z", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis.a", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis.b", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis.c", hal.Type.REAL, hal.Dir.IN) c.ready() diff --git a/configs/sim/axis/vismach/melfa-sim/melfagui.py b/configs/sim/axis/vismach/melfa-sim/melfagui.py index 0471a87e287..5bfe568d3dd 100755 --- a/configs/sim/axis/vismach/melfa-sim/melfagui.py +++ b/configs/sim/axis/vismach/melfa-sim/melfagui.py @@ -9,15 +9,15 @@ import hal c = hal.component("melfagui") -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint6", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("lnkdx", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("lnkdz", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("grip", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint3", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint4", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint5", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint6", hal.Type.REAL, hal.Dir.IN) +c.newpin("lnkdx", hal.Type.REAL, hal.Dir.IN) +c.newpin("lnkdz", hal.Type.REAL, hal.Dir.IN) +c.newpin("grip", hal.Type.REAL, hal.Dir.IN) c.ready() diff --git a/configs/sim/axis/vismach/millturn/millturngui.py b/configs/sim/axis/vismach/millturn/millturngui.py index 865b99f18eb..bed3bd0dd23 100755 --- a/configs/sim/axis/vismach/millturn/millturngui.py +++ b/configs/sim/axis/vismach/millturn/millturngui.py @@ -24,18 +24,18 @@ # in this file, and uncomment last line in HAL file. # add joints. Mill has 3. c = hal.component("millturngui") -c.newpin("jointX", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jointY", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jointZ", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jointA", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("jointX", hal.Type.REAL, hal.Dir.IN) +c.newpin("jointY", hal.Type.REAL, hal.Dir.IN) +c.newpin("jointZ", hal.Type.REAL, hal.Dir.IN) +c.newpin("jointA", hal.Type.REAL, hal.Dir.IN) # kinematics pins -c.newpin("millkins", hal.HAL_BIT, hal.HAL_IN) +c.newpin("millkins", hal.Type.BOOL, hal.Dir.IN) # tool length and diameter pins? -c.newpin("toollength", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tooldiameter", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool-x-offset", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("toollength", hal.Type.REAL, hal.Dir.IN) +c.newpin("tooldiameter", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool-x-offset", hal.Type.REAL, hal.Dir.IN) # tells loadusr pins is ready c.ready() diff --git a/configs/sim/axis/vismach/orphaned models/maho600gui.py b/configs/sim/axis/vismach/orphaned models/maho600gui.py index 285ee079d49..a94094bc024 100755 --- a/configs/sim/axis/vismach/orphaned models/maho600gui.py +++ b/configs/sim/axis/vismach/orphaned models/maho600gui.py @@ -37,19 +37,19 @@ def coords(self): c = hal.component("maho600gui") # table -c.newpin("table", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("table", hal.Type.REAL, hal.Dir.IN) # full width ways that table rides one # this assembly moves up and down for Y -c.newpin("tableway", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tableway", hal.Type.REAL, hal.Dir.IN) # head vertical slide -c.newpin("head", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("head", hal.Type.REAL, hal.Dir.IN) # head tilt -c.newpin("arotate", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("arotate", hal.Type.REAL, hal.Dir.IN) # rotary table -c.newpin("brotate", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("brotate", hal.Type.REAL, hal.Dir.IN) -c.newpin("tool-length", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool-radius", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tool-length", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool-radius", hal.Type.REAL, hal.Dir.IN) c.ready() pivot_len=100 diff --git a/configs/sim/axis/vismach/puma/puma560gui.py b/configs/sim/axis/vismach/puma/puma560gui.py index d07848e914d..bccd2fadcac 100755 --- a/configs/sim/axis/vismach/puma/puma560gui.py +++ b/configs/sim/axis/vismach/puma/puma560gui.py @@ -23,13 +23,13 @@ import hal c = hal.component("puma560gui") -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint6", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("grip", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint3", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint4", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint5", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint6", hal.Type.REAL, hal.Dir.IN) +c.newpin("grip", hal.Type.REAL, hal.Dir.IN) c.ready() diff --git a/configs/sim/axis/vismach/puma/pumagui.py b/configs/sim/axis/vismach/puma/pumagui.py index 7ae1d682b91..d43916f21e8 100755 --- a/configs/sim/axis/vismach/puma/pumagui.py +++ b/configs/sim/axis/vismach/puma/pumagui.py @@ -45,12 +45,12 @@ import hal c = hal.component("pumagui") -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint6", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint3", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint4", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint5", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint6", hal.Type.REAL, hal.Dir.IN) c.ready() ################### diff --git a/configs/sim/axis/vismach/scara/scaragui.py b/configs/sim/axis/vismach/scara/scaragui.py index d9998c4b56a..482bab168b5 100755 --- a/configs/sim/axis/vismach/scara/scaragui.py +++ b/configs/sim/axis/vismach/scara/scaragui.py @@ -22,12 +22,12 @@ import sys c = hal.component("scaragui") -c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint0", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint3", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint4", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint5", hal.Type.REAL, hal.Dir.IN) c.ready() # parameters that define the geometry see scarakins.c for definitions these diff --git a/configs/sim/gmoccapy/lathe_configs/lathehandler.py b/configs/sim/gmoccapy/lathe_configs/lathehandler.py index 6e3fcdadb9e..b8ae574d4b0 100755 --- a/configs/sim/gmoccapy/lathe_configs/lathehandler.py +++ b/configs/sim/gmoccapy/lathe_configs/lathehandler.py @@ -102,7 +102,7 @@ def __init__(self, halcomp,builder,useropts): self.ini.restore_state(self) # A pin to use a physical switch to start the cycle - self.cycle_start = hal_glib.GPin(halcomp.newpin('cycle-start', hal.HAL_BIT, hal.HAL_IN)) + self.cycle_start = hal_glib.GPin(halcomp.newpin('cycle-start', hal.Type.BOOL, hal.Dir.IN)) self.cycle_start.connect('value-changed', self.cycle_pin) # This catches the signal from Touchy to say that the tab is exposed diff --git a/configs/sim/gmoccapy/non_trivial_kinematics/scara/scaragui.py b/configs/sim/gmoccapy/non_trivial_kinematics/scara/scaragui.py index d9998c4b56a..482bab168b5 100755 --- a/configs/sim/gmoccapy/non_trivial_kinematics/scara/scaragui.py +++ b/configs/sim/gmoccapy/non_trivial_kinematics/scara/scaragui.py @@ -22,12 +22,12 @@ import sys c = hal.component("scaragui") -c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint0", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint3", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint4", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint5", hal.Type.REAL, hal.Dir.IN) c.ready() # parameters that define the geometry see scarakins.c for definitions these diff --git a/configs/sim/gmoccapy/non_trivial_kinematics/table-rotary-tilting/xyzac-trt-gui.py b/configs/sim/gmoccapy/non_trivial_kinematics/table-rotary-tilting/xyzac-trt-gui.py index 98f267355d1..2283299ea80 100755 --- a/configs/sim/gmoccapy/non_trivial_kinematics/table-rotary-tilting/xyzac-trt-gui.py +++ b/configs/sim/gmoccapy/non_trivial_kinematics/table-rotary-tilting/xyzac-trt-gui.py @@ -30,19 +30,19 @@ c = hal.component("xyzac-trt-gui") # table-x -c.newpin("table-x", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("table-x", hal.Type.REAL, hal.Dir.IN) # saddle-y -c.newpin("saddle-y", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("saddle-y", hal.Type.REAL, hal.Dir.IN) # head vertical slide -c.newpin("spindle-z", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("spindle-z", hal.Type.REAL, hal.Dir.IN) # table-x tilt-b -c.newpin("tilt-a", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tilt-a", hal.Type.REAL, hal.Dir.IN) # rotary table-x -c.newpin("rotate-c", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotate-c", hal.Type.REAL, hal.Dir.IN) # offsets -c.newpin("y-offset", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("z-offset", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool-offset", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("y-offset", hal.Type.REAL, hal.Dir.IN) +c.newpin("z-offset", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool-offset", hal.Type.REAL, hal.Dir.IN) c.ready() for setting in sys.argv[1:]: exec(setting) diff --git a/configs/sim/gmoccapy/plasma_config/plasma.py b/configs/sim/gmoccapy/plasma_config/plasma.py index 1b798492367..a213d71388d 100644 --- a/configs/sim/gmoccapy/plasma_config/plasma.py +++ b/configs/sim/gmoccapy/plasma_config/plasma.py @@ -94,12 +94,12 @@ def __init__(self, halcomp, builder, useropts): self.ini.restore_state(self) # lets make our pins - self.THC_speed = hal_glib.GPin(halcomp.newpin("THC-Speed", hal.HAL_FLOAT, hal.HAL_OUT)) - self.cut_gap = hal_glib.GPin(halcomp.newpin("Cut-Gap", hal.HAL_FLOAT, hal.HAL_OUT)) - self.g0_gap = hal_glib.GPin(halcomp.newpin("G0-Gap", hal.HAL_FLOAT, hal.HAL_OUT)) - self.pierce_deley = hal_glib.GPin(halcomp.newpin("Pierce-Delay", hal.HAL_FLOAT, hal.HAL_OUT)) - self.pierce_gap = hal_glib.GPin(halcomp.newpin("Pierce-Gap", hal.HAL_FLOAT, hal.HAL_OUT)) - self.target_voltage = hal_glib.GPin(halcomp.newpin("Target-Voltage", hal.HAL_FLOAT, hal.HAL_OUT)) + self.THC_speed = hal_glib.GPin(halcomp.newpin("THC-Speed", hal.Type.REAL, hal.Dir.OUT)) + self.cut_gap = hal_glib.GPin(halcomp.newpin("Cut-Gap", hal.Type.REAL, hal.Dir.OUT)) + self.g0_gap = hal_glib.GPin(halcomp.newpin("G0-Gap", hal.Type.REAL, hal.Dir.OUT)) + self.pierce_deley = hal_glib.GPin(halcomp.newpin("Pierce-Delay", hal.Type.REAL, hal.Dir.OUT)) + self.pierce_gap = hal_glib.GPin(halcomp.newpin("Pierce-Gap", hal.Type.REAL, hal.Dir.OUT)) + self.target_voltage = hal_glib.GPin(halcomp.newpin("Target-Voltage", hal.Type.REAL, hal.Dir.OUT)) # get all widgets and connect them self.lbl_prog_volt = self.builder.get_object("lbl_prog_volt") diff --git a/configs/sim/pyvcp_demo.xml b/configs/sim/pyvcp_demo.xml index 4b986647a7a..561531e3707 100644 --- a/configs/sim/pyvcp_demo.xml +++ b/configs/sim/pyvcp_demo.xml @@ -6,7 +6,7 @@ - + @@ -15,7 +15,7 @@ - + @@ -33,7 +33,7 @@ - + @@ -52,7 +52,7 @@ - + diff --git a/configs/sim/qtdragon_hd/qtdragon_hd_xyz/qtdragon_hd_postgui.hal b/configs/sim/qtdragon_hd/qtdragon_hd_xyz/qtdragon_hd_postgui.hal index 10273528865..c60549ebf48 100644 --- a/configs/sim/qtdragon_hd/qtdragon_hd_xyz/qtdragon_hd_postgui.hal +++ b/configs/sim/qtdragon_hd/qtdragon_hd_xyz/qtdragon_hd_postgui.hal @@ -5,8 +5,8 @@ loadrt logic names=logic-and personality=0x102 addf logic-and servo-thread # load a summing component for adding spindle lift and Z compensation -loadrt scaled_s32_sums -addf scaled-s32-sums.0 servo-thread +loadrt scaled_sint_sums +addf scaled-sint-sums.0 servo-thread loadusr -Wn z_level_compensation z_level_compensation # method parameter must be one of nearest(2), linear(1), cubic (0) @@ -51,8 +51,8 @@ net zpos-cmd z_level_compensation.z-pos <= axis.z.pos-cmd net z_compensation_on z_level_compensation.enable-in <= qtdragon.comp-on net eoffset-zlevel-count z_level_compensation.counts => qtdragon.eoffset-zlevel-count -net eoffset-spindle-count scaled-s32-sums.0.in0 -net eoffset-zlevel-count scaled-s32-sums.0.in1 -setp scaled-s32-sums.0.scale0 1000 -net eoffset-counts scaled-s32-sums.0.out-s +net eoffset-spindle-count scaled-sint-sums.0.in0 +net eoffset-zlevel-count scaled-sint-sums.0.in1 +setp scaled-sint-sums.0.scale0 1000 +net eoffset-counts scaled-sint-sums.0.out-s diff --git a/configs/sim/qtdragon_hd/qtdragon_hd_z_compensation/qtdragon_hd_postgui.hal b/configs/sim/qtdragon_hd/qtdragon_hd_z_compensation/qtdragon_hd_postgui.hal index 567b82e52fb..c08b1b1c2a7 100644 --- a/configs/sim/qtdragon_hd/qtdragon_hd_z_compensation/qtdragon_hd_postgui.hal +++ b/configs/sim/qtdragon_hd/qtdragon_hd_z_compensation/qtdragon_hd_postgui.hal @@ -5,8 +5,8 @@ loadrt logic names=logic-and personality=0x102 addf logic-and servo-thread # load a summing component for adding spindle lift and Z compensation -loadrt scaled_s32_sums -addf scaled-s32-sums.0 servo-thread +loadrt scaled_sint_sums +addf scaled-sint-sums.0 servo-thread loadusr -Wn z_level_compensation z_level_compensation # method parameter must be one of nearest(2), linear(1), cubic (0) @@ -51,8 +51,8 @@ net zpos-cmd z_level_compensation.z-pos <= axis.z.pos-cmd net z_compensation_on z_level_compensation.enable-in <= qtdragon.comp-on net eoffset-zlevel-count z_level_compensation.counts => qtdragon.eoffset-zlevel-count -net eoffset-spindle-count scaled-s32-sums.0.in0 -net eoffset-zlevel-count scaled-s32-sums.0.in1 -setp scaled-s32-sums.0.scale0 1000 -net eoffset-counts scaled-s32-sums.0.out-s +net eoffset-spindle-count scaled-sint-sums.0.in0 +net eoffset-zlevel-count scaled-sint-sums.0.in1 +setp scaled-sint-sums.0.scale0 1000 +net eoffset-counts scaled-sint-sums.0.out-s diff --git a/configs/sim/qtvcp_screens/qtdragon/qtvcp/screens/qtdragon/qtdragon_handler.py b/configs/sim/qtvcp_screens/qtdragon/qtvcp/screens/qtdragon/qtdragon_handler.py index 70b6b3ceee1..cb84ca4f964 100644 --- a/configs/sim/qtvcp_screens/qtdragon/qtvcp/screens/qtdragon/qtdragon_handler.py +++ b/configs/sim/qtvcp_screens/qtdragon/qtvcp/screens/qtdragon/qtdragon_handler.py @@ -322,42 +322,42 @@ def init_utils(self): ############################# def init_pins(self): # spindle control pins - pin = QHAL.newpin("spindle-amps", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-amps", QHAL.HAL_REAL, QHAL.HAL_IN) pin.value_changed.connect(self.spindle_pwr_changed) - pin = QHAL.newpin("spindle-volts", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-volts", QHAL.HAL_REAL, QHAL.HAL_IN) pin.value_changed.connect(self.spindle_pwr_changed) - pin = QHAL.newpin("spindle-fault-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-fault-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.value_changed.connect(self.spindle_fault_changed) - pin = QHAL.newpin("spindle-fault", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-fault", QHAL.HAL_SINT, QHAL.HAL_IN) pin.value_changed.connect(self.spindle_fault_changed) - pin = QHAL.newpin("spindle-modbus-errors-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-modbus-errors-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.value_changed.connect(self.mb_errors_changed) - pin = QHAL.newpin("spindle-modbus-errors", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-modbus-errors", QHAL.HAL_SINT, QHAL.HAL_IN) pin.value_changed.connect(self.mb_errors_changed) - pin = QHAL.newpin("spindle-modbus-connection", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-modbus-connection", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.value_changed.connect(self.mb_connection_changed) - QHAL.newpin("spindle-inhibit", QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newpin("spindle-inhibit", QHAL.HAL_BOOL, QHAL.HAL_OUT) - pin = QHAL.newpin("external-pause", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newpin("external-pause", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.value_changed.connect(self.btn_pause_clicked) # external offset control pins - QHAL.newpin("eoffset-enable", QHAL.HAL_BIT, QHAL.HAL_OUT) - QHAL.newpin("eoffset-clear", QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newpin("eoffset-enable", QHAL.HAL_BOOL, QHAL.HAL_OUT) + QHAL.newpin("eoffset-clear", QHAL.HAL_BOOL, QHAL.HAL_OUT) self.h['eoffset-clear'] = True - QHAL.newpin("eoffset-spindle-count", QHAL.HAL_S32, QHAL.HAL_OUT) - pin = QHAL.newpin("eoffset-is-active", QHAL.HAL_BIT, QHAL.HAL_IN) + QHAL.newpin("eoffset-spindle-count", QHAL.HAL_SINT, QHAL.HAL_OUT) + pin = QHAL.newpin("eoffset-is-active", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.value_changed.connect(self.external_offset_state_changed) # total external offset - pin = QHAL.newpin("eoffset-value", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newpin("eoffset-value", QHAL.HAL_REAL, QHAL.HAL_IN) - self.pin_mpg_in = QHAL.newpin('mpg-in',QHAL.HAL_S32, QHAL.HAL_IN) + self.pin_mpg_in = QHAL.newpin('mpg-in',QHAL.HAL_SINT, QHAL.HAL_IN) self.pin_mpg_in.value_changed.connect(lambda s: self.external_mpg(s)) def init_preferences(self): diff --git a/configs/sim/qtvcp_screens/qtvcp_experimental/lathehandler.py b/configs/sim/qtvcp_screens/qtvcp_experimental/lathehandler.py index 3533b4b167b..4997894099e 100644 --- a/configs/sim/qtvcp_screens/qtvcp_experimental/lathehandler.py +++ b/configs/sim/qtvcp_screens/qtvcp_experimental/lathehandler.py @@ -88,11 +88,11 @@ def __init__(self, halcomp,builder,useropts): self.ini.restore_state(self) # A pin to use a physical switch to start the cycle - self.cycle_start = hal_glib.GPin(halcomp.newpin('cycle-start', hal.HAL_BIT, hal.HAL_IN)) + self.cycle_start = hal_glib.GPin(halcomp.newpin('cycle-start', hal.Type.BOOL, hal.Dir.IN)) self.cycle_start.connect('value-changed', self.cycle_pin) # A pin to mask cycle-start so that Touchy doesn't run auto. - self.visible = hal_glib.GPin(halcomp.newpin('visible', hal.HAL_BIT, hal.HAL_OUT)) + self.visible = hal_glib.GPin(halcomp.newpin('visible', hal.Type.BOOL, hal.Dir.OUT)) # This catches the signal from Touchy to say that the tab is exposed t = self.builder.get_object('eventbox1') diff --git a/configs/sim/woodpecker/1280x1024_5axis/woodpecker_handler.py b/configs/sim/woodpecker/1280x1024_5axis/woodpecker_handler.py index 4efd28be1c6..ae14f3867c3 100644 --- a/configs/sim/woodpecker/1280x1024_5axis/woodpecker_handler.py +++ b/configs/sim/woodpecker/1280x1024_5axis/woodpecker_handler.py @@ -271,47 +271,47 @@ def init_utils(self): ############################# def init_pins(self): # spindle control pins - pin = QHAL.newpin("spindle-amps", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-amps", QHAL.HAL_REAL, QHAL.HAL_IN) pin.value_changed.connect(self.spindle_pwr_changed) - pin = QHAL.newpin("spindle-volts", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-volts", QHAL.HAL_REAL, QHAL.HAL_IN) pin.value_changed.connect(self.spindle_pwr_changed) - pin = QHAL.newpin("spindle-fault", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-fault", QHAL.HAL_UINT, QHAL.HAL_IN) pin.value_changed.connect(self.spindle_fault_changed) - pin = QHAL.newpin("spindle-modbus-errors", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-modbus-errors", QHAL.HAL_UINT, QHAL.HAL_IN) pin.value_changed.connect(self.mb_errors_changed) - QHAL.newpin("spindle-inhibit", QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newpin("spindle-inhibit", QHAL.HAL_BOOL, QHAL.HAL_OUT) # external offset control pins - QHAL.newpin("eoffset-enable", QHAL.HAL_BIT, QHAL.HAL_OUT) - QHAL.newpin("eoffset-clear", QHAL.HAL_BIT, QHAL.HAL_OUT) - QHAL.newpin("eoffset-spindle-count", QHAL.HAL_S32, QHAL.HAL_OUT) - QHAL.newpin("eoffset-count", QHAL.HAL_S32, QHAL.HAL_OUT) + QHAL.newpin("eoffset-enable", QHAL.HAL_BOOL, QHAL.HAL_OUT) + QHAL.newpin("eoffset-clear", QHAL.HAL_BOOL, QHAL.HAL_OUT) + QHAL.newpin("eoffset-spindle-count", QHAL.HAL_SINT, QHAL.HAL_OUT) + QHAL.newpin("eoffset-count", QHAL.HAL_SINT, QHAL.HAL_OUT) - pin = QHAL.newpin("eoffset-value", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newpin("eoffset-value", QHAL.HAL_SINT, QHAL.HAL_IN) pin.value_changed.connect(self.eoffset_changed) - pin = QHAL.newpin("eoffset-zlevel-count", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newpin("eoffset-zlevel-count", QHAL.HAL_SINT, QHAL.HAL_IN) pin.value_changed.connect(self.comp_count_changed) - pin = QHAL.newpin("comp-count", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newpin("comp-count", QHAL.HAL_SINT, QHAL.HAL_IN) pin.value_changed.connect(self.compensate_count_changed) - pin = QHAL.newpin("map-ready", Qhal.HAL_BIT, Qhal.HAL_IN) + pin = QHAL.newpin("map-ready", QHAL.HAL_BOOL, Qhal.HAL_IN) pin.value_changed.connect(self.map_ready_changed) - QHAL.newpin("comp-on", Qhal.HAL_BIT, Qhal.HAL_OUT) + QHAL.newpin("comp-on", QHAL.HAL_BOOL, Qhal.HAL_OUT) - self.pin_mpg_in = self.h.newpin('mpg-in',hal.HAL_S32, hal.HAL_IN) + self.pin_mpg_in = self.h.newpin('mpg-in',hal.Type.SINT, hal.Dir.IN) self.pin_mpg_in.value_changed.connect(lambda s: self.external_mpg(s)) - self.wheel_x = self.h.newpin('jog.wheel.x',hal.HAL_BIT, hal.HAL_OUT) - self.wheel_y = self.h.newpin('jog.wheel.y',hal.HAL_BIT, hal.HAL_OUT) - self.wheel_z = self.h.newpin('jog.wheel.z',hal.HAL_BIT, hal.HAL_OUT) - self.wheel_a = self.h.newpin('jog.wheel.a',hal.HAL_BIT, hal.HAL_OUT) - self.wheel_b = self.h.newpin('jog.wheel.b',hal.HAL_BIT, hal.HAL_OUT) - self.jog_increment = self.h.newpin('jog.wheel.incement',hal.HAL_FLOAT, hal.HAL_OUT) + self.wheel_x = self.h.newpin('jog.wheel.x',hal.Type.BOOL, hal.Dir.OUT) + self.wheel_y = self.h.newpin('jog.wheel.y',hal.Type.BOOL, hal.Dir.OUT) + self.wheel_z = self.h.newpin('jog.wheel.z',hal.Type.BOOL, hal.Dir.OUT) + self.wheel_a = self.h.newpin('jog.wheel.a',hal.Type.BOOL, hal.Dir.OUT) + self.wheel_b = self.h.newpin('jog.wheel.b',hal.Type.BOOL, hal.Dir.OUT) + self.jog_increment = self.h.newpin('jog.wheel.incement',hal.Type.REAL, hal.Dir.OUT) # MPG axis select pins - pin = QHAL.newpin("axis-select-x", Qhal.HAL_BIT, Qhal.HAL_IN) - pin = QHAL.newpin("axis-select-y", Qhal.HAL_BIT, Qhal.HAL_IN) - pin = QHAL.newpin("axis-select-z", Qhal.HAL_BIT, Qhal.HAL_IN) - pin = QHAL.newpin("axis-select-a", Qhal.HAL_BIT, Qhal.HAL_IN) - pin = QHAL.newpin("axis-select-b", Qhal.HAL_BIT, Qhal.HAL_IN) + pin = QHAL.newpin("axis-select-x", QHAL.HAL_BOOL, Qhal.HAL_IN) + pin = QHAL.newpin("axis-select-y", QHAL.HAL_BOOL, Qhal.HAL_IN) + pin = QHAL.newpin("axis-select-z", QHAL.HAL_BOOL, Qhal.HAL_IN) + pin = QHAL.newpin("axis-select-a", QHAL.HAL_BOOL, Qhal.HAL_IN) + pin = QHAL.newpin("axis-select-b", QHAL.HAL_BOOL, Qhal.HAL_IN) def init_preferences(self): if not self.w.PREFS_: diff --git a/configs/sim/woodpecker/compensate.py b/configs/sim/woodpecker/compensate.py index 1c3bdbe3f5a..06cd082a320 100755 --- a/configs/sim/woodpecker/compensate.py +++ b/configs/sim/woodpecker/compensate.py @@ -119,15 +119,15 @@ def compensate(self): def run(self): self.h = hal.component("compensate") - self.h.newpin("enable-in", hal.HAL_BIT, hal.HAL_IN) - self.h.newpin("map-ready", hal.HAL_BIT, hal.HAL_OUT) - self.h.newpin("scale", hal.HAL_FLOAT, hal.HAL_OUT) - self.h.newpin("counts", hal.HAL_S32, hal.HAL_OUT) - self.h.newpin("clear", hal.HAL_BIT, hal.HAL_IN) - self.h.newpin("x-pos", hal.HAL_FLOAT, hal.HAL_IN) - self.h.newpin("y-pos", hal.HAL_FLOAT, hal.HAL_IN) - self.h.newpin("z-pos", hal.HAL_FLOAT, hal.HAL_IN) - self.h.newpin("fade-height", hal.HAL_FLOAT, hal.HAL_IN) + self.h.newpin("enable-in", hal.Type.BOOL, hal.Dir.IN) + self.h.newpin("map-ready", hal.Type.BOOL, hal.Dir.OUT) + self.h.newpin("scale", hal.Type.REAL, hal.Dir.OUT) + self.h.newpin("counts", hal.Type.SINT, hal.Dir.OUT) + self.h.newpin("clear", hal.Type.BOOL, hal.Dir.IN) + self.h.newpin("x-pos", hal.Type.REAL, hal.Dir.IN) + self.h.newpin("y-pos", hal.Type.REAL, hal.Dir.IN) + self.h.newpin("z-pos", hal.Type.REAL, hal.Dir.IN) + self.h.newpin("fade-height", hal.Type.REAL, hal.Dir.IN) self.h.ready() self.stat = linuxcnc.stat() diff --git a/configs/sim/woodpecker/numstr.py b/configs/sim/woodpecker/numstr.py index 5ebaeeb32d4..77fa59a0f7e 100644 --- a/configs/sim/woodpecker/numstr.py +++ b/configs/sim/woodpecker/numstr.py @@ -2,7 +2,7 @@ import hal import time h = hal.component("numstr") -h.newpin("in", hal.HAL_S32, hal.HAL_IN) +h.newpin("in", hal.Type.SINT, hal.Dir.IN) h.ready() tmp = 0 try: diff --git a/configs/sim/woodpecker/python/stdglue.py b/configs/sim/woodpecker/python/stdglue.py index ea32910bece..12cf833a7ec 100644 --- a/configs/sim/woodpecker/python/stdglue.py +++ b/configs/sim/woodpecker/python/stdglue.py @@ -33,8 +33,8 @@ def build_hal(self): import hal try: h=hal.component('remapStat') - h.newpin("tool", hal.HAL_S32, hal.HAL_OUT) - h.newpin("wear", hal.HAL_S32, hal.HAL_OUT) + h.newpin("tool", hal.Type.SINT, hal.Dir.OUT) + h.newpin("wear", hal.Type.SINT, hal.Dir.OUT) h.ready() self.hal_tool_comp = h except Exception as e: diff --git a/configs/sim/woodpecker/woodpecker.hal b/configs/sim/woodpecker/woodpecker.hal index a923d497292..0d674cb5d17 100644 --- a/configs/sim/woodpecker/woodpecker.hal +++ b/configs/sim/woodpecker/woodpecker.hal @@ -41,7 +41,7 @@ setp near.0.scale 1.01 # Joint 0 # axis enable chain -newsig emcmot.0.enable bit +newsig emcmot.0.enable bool sets emcmot.0.enable FALSE net emcmot.0.enable <= joint.0.amp-enable-out net emcmot.0.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.00.enable pid.0.enable @@ -75,7 +75,7 @@ setp pid.0.maxerror [JOINT_0]MAX_ERROR # Joint 1 # axis enable chain -newsig emcmot.1.enable bit +newsig emcmot.1.enable bool sets emcmot.1.enable FALSE net emcmot.1.enable <= joint.1.amp-enable-out net emcmot.1.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.01.enable pid.1.enable @@ -109,7 +109,7 @@ setp pid.1.maxerror [JOINT_1]MAX_ERROR # Joint 2 # axis enable chain -newsig emcmot.2.enable bit +newsig emcmot.2.enable bool sets emcmot.2.enable FALSE net emcmot.2.enable <= joint.2.amp-enable-out net emcmot.2.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.02.enable pid.2.enable @@ -143,7 +143,7 @@ setp pid.2.maxerror [JOINT_2]MAX_ERROR # Joint 3 # axis enable chain -newsig emcmot.3.enable bit +newsig emcmot.3.enable bool sets emcmot.3.enable FALSE net emcmot.3.enable <= joint.3.amp-enable-out net emcmot.3.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.03.enable pid.3.enable diff --git a/configs/sim/woodpecker/woodpecker_/woodpecker_handler.py b/configs/sim/woodpecker/woodpecker_/woodpecker_handler.py index d0d343a8ddd..ee580b11499 100644 --- a/configs/sim/woodpecker/woodpecker_/woodpecker_handler.py +++ b/configs/sim/woodpecker/woodpecker_/woodpecker_handler.py @@ -151,29 +151,29 @@ def initialized__(self): ############################# def init_pins(self): # spindle control pins - pin = self.h.newpin("spindle_amps", hal.HAL_FLOAT, hal.HAL_IN) + pin = self.h.newpin("spindle_amps", hal.Type.REAL, hal.Dir.IN) pin.value_changed.connect(self.spindle_pwr_changed) - pin = self.h.newpin("spindle_volts", hal.HAL_FLOAT, hal.HAL_IN) + pin = self.h.newpin("spindle_volts", hal.Type.REAL, hal.Dir.IN) pin.value_changed.connect(self.spindle_pwr_changed) - pin = self.h.newpin("spindle_fault", hal.HAL_U32, hal.HAL_IN) + pin = self.h.newpin("spindle_fault", hal.Type.UINT, hal.Dir.IN) pin.value_changed.connect(self.spindle_fault_changed) - pin = self.h.newpin("modbus-errors", hal.HAL_U32, hal.HAL_IN) + pin = self.h.newpin("modbus-errors", hal.Type.UINT, hal.Dir.IN) pin.value_changed.connect(self.mb_errors_changed) - # self.h.newpin("spindle_pause", hal.HAL_BIT, hal.HAL_OUT) + # self.h.newpin("spindle_pause", hal.Type.BOOL, hal.Dir.OUT) # external offset control pins - self.h.newpin("eoffset_enable", hal.HAL_BIT, hal.HAL_OUT) - self.h.newpin("eoffset_clear", hal.HAL_BIT, hal.HAL_OUT) - self.h.newpin("eoffset_count", hal.HAL_S32, hal.HAL_OUT) - pin = self.h.newpin("eoffset_value", hal.HAL_FLOAT, hal.HAL_IN) + self.h.newpin("eoffset_enable", hal.Type.BOOL, hal.Dir.OUT) + self.h.newpin("eoffset_clear", hal.Type.BOOL, hal.Dir.OUT) + self.h.newpin("eoffset_count", hal.Type.SINT, hal.Dir.OUT) + pin = self.h.newpin("eoffset_value", hal.Type.REAL, hal.Dir.IN) pin.value_changed.connect(self.eoffset_changed) - self.pin_mpg_in = self.h.newpin('mpg-in',hal.HAL_S32, hal.HAL_IN) + self.pin_mpg_in = self.h.newpin('mpg-in',hal.Type.SINT, hal.Dir.IN) self.pin_mpg_in.value_changed.connect(lambda s: self.external_mpg(s)) - self.wheel_x = self.h.newpin('jog.wheel.x',hal.HAL_BIT, hal.HAL_OUT) - self.wheel_y = self.h.newpin('jog.wheel.y',hal.HAL_BIT, hal.HAL_OUT) - self.wheel_z = self.h.newpin('jog.wheel.z',hal.HAL_BIT, hal.HAL_OUT) - self.wheel_a = self.h.newpin('jog.wheel.a',hal.HAL_BIT, hal.HAL_OUT) - self.jog_increment = self.h.newpin('jog.wheel.incement',hal.HAL_FLOAT, hal.HAL_OUT) + self.wheel_x = self.h.newpin('jog.wheel.x',hal.Type.BOOL, hal.Dir.OUT) + self.wheel_y = self.h.newpin('jog.wheel.y',hal.Type.BOOL, hal.Dir.OUT) + self.wheel_z = self.h.newpin('jog.wheel.z',hal.Type.BOOL, hal.Dir.OUT) + self.wheel_a = self.h.newpin('jog.wheel.a',hal.Type.BOOL, hal.Dir.OUT) + self.jog_increment = self.h.newpin('jog.wheel.incement',hal.Type.REAL, hal.Dir.OUT) def init_preferences(self): if not self.w.PREFS_: diff --git a/debian/tests/linuxcnc-test-ui.py b/debian/tests/linuxcnc-test-ui.py index 57e3871c667..c08d729ffd4 100755 --- a/debian/tests/linuxcnc-test-ui.py +++ b/debian/tests/linuxcnc-test-ui.py @@ -21,10 +21,10 @@ # Create and connect test feedback comp # h = hal.component("test-ui") -h.newpin("Xpos", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("Ypos", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("Zpos", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("counter", hal.HAL_FLOAT, hal.HAL_IN) +h.newpin("Xpos", hal.Type.REAL, hal.Dir.IN) +h.newpin("Ypos", hal.Type.REAL, hal.Dir.IN) +h.newpin("Zpos", hal.Type.REAL, hal.Dir.IN) +h.newpin("counter", hal.Type.REAL, hal.Dir.IN) h.ready() os.system("halcmd source ./linuxcnc-test.hal") diff --git a/docs/po4a.cfg b/docs/po4a.cfg index 85f3cf55eef..785af8e78fe 100644 --- a/docs/po4a.cfg +++ b/docs/po4a.cfg @@ -400,7 +400,7 @@ [type: man_def] build/man/man1/thermistor.1 $lang:build/man/$lang/man1/thermistor.1 [type: man_def] build/man/man1/wj200_vfd.1 $lang:build/man/$lang/man1/wj200_vfd.1 [type: man_def] build/man/man9/abs.9 $lang:build/man/$lang/man9/abs.9 -[type: man_def] build/man/man9/abs_s32.9 $lang:build/man/$lang/man9/abs_s32.9 +[type: man_def] build/man/man9/abs_sint.9 $lang:build/man/$lang/man9/abs_sint.9 [type: man_def] build/man/man9/and2.9 $lang:build/man/$lang/man9/and2.9 [type: man_def] build/man/man9/axistest.9 $lang:build/man/$lang/man9/axistest.9 [type: man_def] build/man/man9/bin2gray.9 $lang:build/man/$lang/man9/bin2gray.9 @@ -415,17 +415,18 @@ [type: man_def] build/man/man9/clarke3.9 $lang:build/man/$lang/man9/clarke3.9 [type: man_def] build/man/man9/clarkeinv.9 $lang:build/man/$lang/man9/clarkeinv.9 [type: man_def] build/man/man9/comp.9 $lang:build/man/$lang/man9/comp.9 -[type: man_def] build/man/man9/conv_bit_float.9 $lang:build/man/$lang/man9/conv_bit_float.9 -[type: man_def] build/man/man9/conv_bit_s32.9 $lang:build/man/$lang/man9/conv_bit_s32.9 -[type: man_def] build/man/man9/conv_bit_u32.9 $lang:build/man/$lang/man9/conv_bit_u32.9 -[type: man_def] build/man/man9/conv_float_s32.9 $lang:build/man/$lang/man9/conv_float_s32.9 -[type: man_def] build/man/man9/conv_float_u32.9 $lang:build/man/$lang/man9/conv_float_u32.9 -[type: man_def] build/man/man9/conv_s32_bit.9 $lang:build/man/$lang/man9/conv_s32_bit.9 -[type: man_def] build/man/man9/conv_s32_float.9 $lang:build/man/$lang/man9/conv_s32_float.9 -[type: man_def] build/man/man9/conv_s32_u32.9 $lang:build/man/$lang/man9/conv_s32_u32.9 -[type: man_def] build/man/man9/conv_u32_bit.9 $lang:build/man/$lang/man9/conv_u32_bit.9 -[type: man_def] build/man/man9/conv_u32_float.9 $lang:build/man/$lang/man9/conv_u32_float.9 -[type: man_def] build/man/man9/conv_u32_s32.9 $lang:build/man/$lang/man9/conv_u32_s32.9 +[type: man_def] build/man/man9/conv_bool_real.9 $lang:build/man/$lang/man9/conv_bool_real.9 +[type: man_def] build/man/man9/conv_bool_sint.9 $lang:build/man/$lang/man9/conv_bool_sint.9 +[type: man_def] build/man/man9/conv_bool_uint.9 $lang:build/man/$lang/man9/conv_bool_uint.9 +[type: man_def] build/man/man9/conv_real_bool.9 $lang:build/man/$lang/man9/conv_real_bool.9 +[type: man_def] build/man/man9/conv_real_sint.9 $lang:build/man/$lang/man9/conv_real_sint.9 +[type: man_def] build/man/man9/conv_real_uint.9 $lang:build/man/$lang/man9/conv_real_uint.9 +[type: man_def] build/man/man9/conv_sint_bool.9 $lang:build/man/$lang/man9/conv_sint_bool.9 +[type: man_def] build/man/man9/conv_sint_real.9 $lang:build/man/$lang/man9/conv_sint_real.9 +[type: man_def] build/man/man9/conv_sint_uint.9 $lang:build/man/$lang/man9/conv_sint_uint.9 +[type: man_def] build/man/man9/conv_uint_bool.9 $lang:build/man/$lang/man9/conv_uint_bool.9 +[type: man_def] build/man/man9/conv_uint_real.9 $lang:build/man/$lang/man9/conv_uint_real.9 +[type: man_def] build/man/man9/conv_uint_sint.9 $lang:build/man/$lang/man9/conv_uint_sint.9 [type: man_def] build/man/man9/corexy_by_hal.9 $lang:build/man/$lang/man9/corexy_by_hal.9 [type: man_def] build/man/man9/dbounce.9 $lang:build/man/$lang/man9/dbounce.9 [type: man_def] build/man/man9/ddt.9 $lang:build/man/$lang/man9/ddt.9 diff --git a/docs/src/common/glossary.adoc b/docs/src/common/glossary.adoc index 4dc242751c8..22e0d7e70d0 100644 --- a/docs/src/common/glossary.adoc +++ b/docs/src/common/glossary.adoc @@ -321,7 +321,7 @@ Servo Loop:: Signed Integer:: (((Signed Integer))) A whole number that can have a positive or negative sign. - In HAL it is usually a <>, but could be also a <>. + In HAL it is a <>. Spindle:: (((spindle))) The part of a machine tool that spins @@ -364,7 +364,7 @@ Units:: Unsigned Integer:: (((Unsigned Integer))) A whole number that has no sign. - In HAL it is usually a <> but could be also a <>. + In HAL it is a <>. World Coordinates:: (((world coordinates))) This is the absolute diff --git a/docs/src/config/ini-homing.adoc b/docs/src/config/ini-homing.adoc index 7f99d8552de..b55b332bf73 100644 --- a/docs/src/config/ini-homing.adoc +++ b/docs/src/config/ini-homing.adoc @@ -358,17 +358,17 @@ Example: Synced joints 0,1 using negative sequence (-1) for synchronized homing [source,hal] ---- loadrt mux2 names=home_sequence_mux -loadrt conv_float_s32 names=home_sequence_s32 +loadrt conv_real_sint names=home_sequence_sint setp home_sequence_mux.in0 -1 setp home_sequence_mux.in1 1 addf home_sequence_mux servo-thread -addf home_sequence_s32 servo-thread +addf home_sequence_sint servo-thread ... net home_seq_float <= home_sequence_mux.out -net home_seq_float => home_sequence_s32.in -net home_seq_s32 <= home_sequence_s32.out -net home_seq_s32 => ini.0.home_sequence -net home_seq_s32 => ini.1.home_sequence +net home_seq_float => home_sequence_sint.in +net home_seq_sint <= home_sequence_sint.out +net home_seq_sint => ini.0.home_sequence +net home_seq_sint => ini.1.home_sequence ... # allow_jjog: pin created by a virtual panel or hardware switch net hsequence_select <= allow_jjog diff --git a/docs/src/config/python-hal-interface.adoc b/docs/src/config/python-hal-interface.adoc index 00ec2cf878e..461c813a3ae 100644 --- a/docs/src/config/python-hal-interface.adoc +++ b/docs/src/config/python-hal-interface.adoc @@ -55,10 +55,6 @@ The old defined constants are still supported for backwards compatibility. .Example: [source,python] ---- -# Old (deprecated) style: -comp.newpin("in-a", hal.HAL_FLOAT, hal.HAL_IN) - -# New style: comp.newpin("in-a", hal.Type.REAL, hal.Dir.IN) ---- @@ -71,22 +67,22 @@ The `hal.Type` enum is used to specify the type of pin, parameter and signal: * `hal.Type.UINT` - An unsigned quantity with range 0...+2^64^-1 * `hal.Type.REAL` - A floating point quantity of range ±1.80×10^308^ * `hal.Type.PORT` - An opaque quantity representing a communication channel (pins only) -* `hal.Type.S32` - A signed quantity with range -2^31^...+2^31^-1 (see notes below) -* `hal.Type.U32` - An unsigned quantity with range 0...+2^32^-1 (see notes below) There are aliases in the `hal.Type` enum for all types with the `HAL_` prefix (e.g. `hal.Type.HAL_BOOL`, etc.). [NOTE] ==== -The constants previously used (`hal.HAL_BIT`, `hal.HAL_FLOAT`, etc.) are still available. +The constants previously used (`hal.HAL_BIT`, `hal.HAL_FLOAT`, etc.) are deprecated and emit a warning. You should upgrade your code to use the enumerated types with the new names instead. -==== -[IMPORTANT] -==== -The 32-bit types will soon be replaced by 64-bit types. -The names will remain for some time, but they will map to the larger type automatically. -The `S32` and `U32` names will then no longer be unique and the range will be larger. +[source,python] +---- +# Old (deprecated) style: +comp.newpin("in-a", hal.HAL_FLOAT, hal.HAL_IN) + +# New style: +comp.newpin("in-a", hal.Type.REAL, hal.Dir.IN) +---- ==== ==== HAL direction @@ -105,7 +101,10 @@ Also the direction enums are available with the `HAL_` prefix (like `hal.Dir.HAL ==== Old style HAL constants (deprecated) Old style constants (deprecated): -`hal.HAL_BIT`, `hal.HAL_S32`, `hal.HAL_U32`, `hal.HAL_S64`, `hal.HAL_U64`, `hal.HAL_FLOAT`, `hal.HAL_PORT`. +`hal.HAL_BOOL`, `hal.HAL_SINT`, `hal.HAL_UINT`, `hal.HAL_REAL`, `hal.HAL_PORT`. + +Deprecated constants: +`hal.HAL_BIT`, `hal.HAL_S64`, `hal.HAL_U64`, `hal.HAL_FLOAT`. Old style deprecated pin direction constants (deprecated): `hal.HAL_IN`, `hal.HAL_OUT`, `hal.HAL_IO`. @@ -576,7 +575,7 @@ result = hal.query.pin("my.pin.name") result = { "haltype" : "pin", "name" : "my.pin.name", - "type" : hal.Type., + "type" : hal.Type., "dir" : hal.Dir., "value" : , "alias" : "alias.name"|None, @@ -597,7 +596,7 @@ result = hal.query.param("my.param.name") result = { "haltype" : "parameter", "name" : "my.param.name", - "type" : hal.Type., + "type" : hal.Type., "dir" : hal.Dir., "value" : , "alias" : "alias.name"|None, @@ -617,7 +616,7 @@ result = hal.query.signal("my.signal.name") result = { "haltype" : "signal", "name" : "my.signal.name", - "type" : hal.Type., + "type" : hal.Type., "value" : , "writers" : , "readers" : , diff --git a/docs/src/drivers/mesa_modbus.adoc b/docs/src/drivers/mesa_modbus.adoc index 8e118b49883..4040b5cfb5a 100644 --- a/docs/src/drivers/mesa_modbus.adoc +++ b/docs/src/drivers/mesa_modbus.adoc @@ -103,10 +103,10 @@ from HAL and pass them to the Modbus device. Modbus *read* commands will read data from the device and pass that to HAL *output* pins for use by other components. -HAL_BIT, HAL_U32 and HAL_S32 pins will present the (16 bit) Modbus +HAL_BOOL, HAL_UINT and HAL_SINT pins will present the (16 bit) Modbus registers exactly as the bits are delivered from the device and will send them to the device as 16 bit values according to standard C type -conversion standards. HAL_FLOAT values are treated differently. When a +conversion standards. HAL_REAL values are treated differently. When a float pin is specified then two extra HAL pins are created with the same name but suffixed with -scale and offset. The value from the modbus register will be interpreted as a sighed-16 bit number. It will @@ -118,7 +118,7 @@ The reverse transformation is performed when writing to the device. All Modbus registers are 16 bits. It is possible that in some applications this might be used to represent encoder counts or some other number that -will wrap-around. To circumvent this problem in the case of the HAL_S32 +will wrap-around. To circumvent this problem in the case of the HAL_SINT pin type the registers will be promoted to signed 64-bit internally then multiplied by the "scale" pin value and presented as a floating point value on a HAL pin with the suffix "scaled". @@ -193,7 +193,7 @@ The format of the channel descriptors is: {TYPE, FUNC, ADDR, COUNT, pin_name} -TYPE is one of HAL_BIT, HAL_FLOAT, HAL_S32, HAL_U32 +TYPE is one of HAL_BOOL, HAL_REAL, HAL_SINT, HAL_UINT FUNC = 1, 2, 3, 4, 5, 6, 15, 16 - Modbus commands COUNT = number of coils/registers to read */ @@ -203,21 +203,21 @@ COUNT = number of coils/registers to read static const hm2_modbus_chan_descriptor_t channels[] = { /* {TYPE, FUNC, ADDR, COUNT, pin_name} */ // Create 8 HAL bit pins coil-00 .. -07 supplying the values of coils at 0x0000 - {HAL_BIT, 1, 0x0000, 8, "coil"}, + {HAL_BOOL, 1, 0x0000, 8, "coil"}, // Create 8 HAL bit pins input-00 .. -07 supplying the values of inputs at 0x0000 - {HAL_BIT, 2, 0x0000, 8, "input"}, + {HAL_BOOL, 2, 0x0000, 8, "input"}, // Create a HAL pin to set the coil at address 0x0010 - {HAL_BIT, 5, 0x0010, 1, "coil-0"}, + {HAL_BOOL, 5, 0x0010, 1, "coil-0"}, // Create 8 HAL pins to set the coils at 0x0020 - {HAL_BIT, 15, 0x0020, 8, "more_coils"}, + {HAL_BOOL, 15, 0x0020, 8, "more_coils"}, // Create a scaled floating point pin calculated from input register 0x0100 - {HAL_FLOAT, 4, 0x0100, 1, "float"}, + {HAL_REAL, 4, 0x0100, 1, "float"}, // Create 4 unsigned integer HAL pins from the holding registers at 0x0200-0x203 - {HAL_S32, 3, 0x0003, 4, "holding"}, + {HAL_SINT, 3, 0x0003, 4, "holding"}, // Create a single signed int HAL pin to control the register at 0x0300 - {HAL_S32, 6, 0x0300, 1, "relay-3"}, + {HAL_SINT, 6, 0x0300, 1, "relay-3"}, // Create 7 scaled FP HAL pins to control holfing registers at 0x400-0x406 - {HAL_FLOAT, 16, 0x0300, 1, "more_floats"}, + {HAL_REAL, 16, 0x0300, 1, "more_floats"}, }; ---- @@ -252,12 +252,12 @@ would suffice ---- static const hm2_modbus_chan_descriptor_t channels[] = { /* {TYPE, FUNC, ADDR, COUNT, pin_name} */ - {HAL_FLOAT, 3, 0x0000, 1, "volts"}, + {HAL_REAL, 3, 0x0000, 1, "volts"}, }; ---- -The valid HAL pin types supported are HAL_BIT, HAL_FLOAT, HAL_U32 and -HAL_S32. +The valid HAL pin types supported are HAL_BOOL, HAL_REAL, HAL_UINT and +HAL_SINT. The supported Modbus command types are: diff --git a/docs/src/getting-started/updating-linuxcnc.adoc b/docs/src/getting-started/updating-linuxcnc.adoc index d9f44143dab..265ae4c5bcd 100644 --- a/docs/src/getting-started/updating-linuxcnc.adoc +++ b/docs/src/getting-started/updating-linuxcnc.adoc @@ -161,6 +161,57 @@ package manager with this command: sudo dpkg -i linuxcnc_2.9.8.deb ---- +== Updating Configuration Files for 2.10 + +A large set of changes have been implemented in the new version. +The changes include: + +* INI: Reworked INI-file parser with consistent types +* HAL: New HAL types; remove HAL_S32 and HAL_U32 and replace with 64-bit HAL_SINT and HAL_UINT +* HAL: Make the underlying HAL memory inaccessible and use a proper API + +=== New HAL types + +All integer HAL pins are now 64-bit only and the old HAL type names have changed: + +* `HAL_BOOL` - formerly HAL_BIT +* `HAL_REAL` - formerly HAL_FLOAT +* `HAL_SINT` - formerly HAL_S64 +* `HAL_UINT` - formerly HAL_U64 + +The old 32-bit types have been removed: +* `HAL_S32` - removed +* `HAL_U32` - removed + +=== Component updates + +Components were renamed in the HAL type replacement process because they included the old type names: +* conv_XXXX_YYYY - coversion between types now use 'bool', 'real', 'sint' and 'uint' for XXXX and YYYY. +* abs_s32 - replaced by abs_sint. +* abs_s64 - replaced by abs_sint. +* scaled_s32_sums - replaces by scaled_sint_sums. + +=== Updated Python interface + +The HAL type update is also added to the `hal` module. +Additionally, the type names and direction names have been added as IntEnum types. +All code has been updated to use them and you are encouraged to do the same: + +[source,python] +---- +import hal +... + +# Old: +comp.newpin("pinname", hal.HAL_FLOAT, hal.HAL_IN) + +# New: +comp.newpin("pinname", hal.Type.REAL, hal.Dir.IN) +---- + +The old HAL_S32 and HAL_U32 names have been removed and the old HAL type names +HAL_BIT, HAL_FLOAT, HAL_S64 and HAL_U64 will result in a deprecation warning. + == Updating Configuration Files for 2.9 diff --git a/docs/src/gui/axis.adoc b/docs/src/gui/axis.adoc index 28f121355a1..b2ba7eb2f0b 100644 --- a/docs/src/gui/axis.adoc +++ b/docs/src/gui/axis.adoc @@ -1194,7 +1194,7 @@ commands.set_view_z() [source,python] ---- def user_hal_pins(): - comp.newpin('my-new-in-pin', hal.HAL_BIT, hal.HAL_IN) + comp.newpin('my-new-in-pin', hal.Type.BOOL, hal.Dir.IN) comp.ready() ---- @@ -1205,13 +1205,13 @@ def user_hal_pins(): # create a component mycomp = hal.component('my_component') -mycomp.newpin('idle-led',hal.HAL_BIT,hal.HAL_IN) -mycomp.newpin('pause-led',hal.HAL_BIT,hal.HAL_IN) +mycomp.newpin('idle-led', hal.Type.BOOL, hal.Dir.IN) +mycomp.newpin('pause-led', hal.Type.BOOL, hal.Dir.IN) mycomp.ready() # connect pins -hal.new_sig('idle-led',hal.HAL_BIT) +hal.new_sig('idle-led', hal.Type.BOOL) hal.connect('halui.program.is-idle','idle-led') hal.connect('my_component.idle-led','idle-led') diff --git a/docs/src/gui/gladevcp.adoc b/docs/src/gui/gladevcp.adoc index b6a085afd49..9ed0faf49d8 100644 --- a/docs/src/gui/gladevcp.adoc +++ b/docs/src/gui/gladevcp.adoc @@ -2618,7 +2618,7 @@ If you need HAL pins which are not associated with a specific HAL widget, add th import hal_glib ... # in your handler class __init__(): -self.example_trigger = hal_glib.GPin(halcomp.newpin('example-trigger', hal.HAL_BIT, hal.HAL_IN)) +self.example_trigger = hal_glib.GPin(halcomp.newpin('example-trigger', hal.Type.BOOL, hal.Dir.IN)) ---- To get a callback when this pin's value changes, associate a `value-change` callback with this pin, add: @@ -2681,7 +2681,7 @@ class HandlerClass: # HAL pin with change callback. # When the pin's value changes the callback is executed. - self.max_value = hal_glib.GPin(halcomp.newpin('max-value', hal.HAL_FLOAT, hal.HAL_IN)) + self.max_value = hal_glib.GPin(halcomp.newpin('max-value', hal.Type.REAL, hal.Dir.IN)) self.max_value.connect('value-changed', self._on_max_value_change) inifile = linuxcnc.ini(os.getenv("INI_FILE_NAME")) @@ -2713,7 +2713,7 @@ Then make a pin and connect a 'value-changed' (the watcher) signal to a function ---- class HandlerClass: def __init__(self, halcomp,builder,useropts): - self.example_trigger = hal_glib.GPin(halcomp.newpin('example-trigger', hal.HAL_BIT, hal.HAL_IN)) + self.example_trigger = hal_glib.GPin(halcomp.newpin('example-trigger', hal.Type.BOOL, hal.Dir.IN)) self.example_trigger.connect('value-changed', self._on_example_trigger_change) ---- diff --git a/docs/src/gui/gstat.adoc b/docs/src/gui/gstat.adoc index 11b558d0193..c4455ec6aaa 100644 --- a/docs/src/gui/gstat.adoc +++ b/docs/src/gui/gstat.adoc @@ -68,8 +68,8 @@ def mode_changed(obj, data): # Make a component and pins h = hal.component("metric_status") -h.newpin("g20", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("g21", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("g20", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("g21", hal.Type.BOOL, hal.Dir.OUT) h.ready() # connect a GSTAT message to a callback function diff --git a/docs/src/gui/qtdragon.adoc b/docs/src/gui/qtdragon.adoc index 692eac20a5d..f664151ab0e 100644 --- a/docs/src/gui/qtdragon.adoc +++ b/docs/src/gui/qtdragon.adoc @@ -838,8 +838,8 @@ loadrt logic names=logic-and personality=0x102 addf logic-and servo-thread # load a summing component for adding spindle lift and Z compensation -loadrt scaled_s32_sums -addf scaled-s32-sums.0 servo-thread +loadrt scaled_sint_sums +addf scaled-sint-sums.0 servo-thread loadusr -Wn z_level_compensation z_level_compensation # method parameter must be one of nearest(2), linear(1), cubic (0) @@ -872,10 +872,10 @@ net z_compensation_on z_level_compensation.enable-in <= qtdragon.comp-on net eoffset-zlevel-count z_level_compensation.counts => qtdragon.eoffset-zlevel-count # add Z level and scaled spindle raise level values together -net eoffset-spindle-count scaled-s32-sums.0.in0 -net eoffset-zlevel-count scaled-s32-sums.0.in1 -setp scaled-s32-sums.0.scale0 1000 -net eoffset-counts scaled-s32-sums.0.out-s +net eoffset-spindle-count scaled-sint-sums.0.in0 +net eoffset-zlevel-count scaled-sint-sums.0.in1 +setp scaled-sint-sums.0.scale0 1000 +net eoffset-counts scaled-sint-sums.0.out-s ---- @@ -945,13 +945,13 @@ Currently the probe tool number is only editable in the preference file: + ps_probe_tool = 1 ---- -`qtversaprobe.enable` (HAL_BIT):: Measurement enabled or not tool. Reflects screen button state. -`qtversaprobe.blockheight` (HAL_FLOAT):: The measured height of the top face of the workpiece. Reflects screen entry. -`qtversaprobe.probeheight` (HAL_FLOAT):: The toolsetter probe switch height. Reflects screen entry. -`qtversaprobe.searchvel` (HAL_FLOAT):: The velocity to search for the tool probe switch -`qtversaprobe.probevel` (HAL_FLOAT):: The velocity to probe tool length. Reflects screen entry. -`qtversaprobe.backoffdist` (HAL_FLOAT):: The distance the probe backs off after triggering. Reflects screen entry. -`qtversaprobe.probe-loaded` (HAL_BIT):: Reflect if the current tool is equal to the preference file probe number. +`qtversaprobe.enable` (HAL_BOOL):: Measurement enabled or not tool. Reflects screen button state. +`qtversaprobe.blockheight` (HAL_REAL):: The measured height of the top face of the workpiece. Reflects screen entry. +`qtversaprobe.probeheight` (HAL_REAL):: The toolsetter probe switch height. Reflects screen entry. +`qtversaprobe.searchvel` (HAL_REAL):: The velocity to search for the tool probe switch +`qtversaprobe.probevel` (HAL_REAL):: The velocity to probe tool length. Reflects screen entry. +`qtversaprobe.backoffdist` (HAL_REAL):: The distance the probe backs off after triggering. Reflects screen entry. +`qtversaprobe.probe-loaded` (HAL_BOOL):: Reflect if the current tool is equal to the preference file probe number. === Basic probe @@ -1242,12 +1242,12 @@ Initial testing with no tool and safe heights is recommended. Versaprobe offers 5 output pins for tool measurement purpose. The pins are used to be read from a remap G-code subroutine, so the code can react to different values. -`qtversaprobe.enable` (HAL_BIT):: Measurement enabled or not tool. Reflects screen button state. -`qtversaprobe.blockheight` (HAL_FLOAT):: The measured height of the top face of the workpiece. Reflects screen entry. -`qtversaprobe.probeheight` (HAL_FLOAT):: The toolsetter probe switch height. Reflects screen entry. -`qtversaprobe.searchvel` (HAL_FLOAT):: The velocity to search for the tool probe switch -`qtversaprobe.probevel` (HAL_FLOAT):: The velocity to probe tool length. Reflects screen entry. -`qtversaprobe.backoffdist` (HAL_FLOAT):: The distance the probe backs off after triggering. Reflects screen entry. +`qtversaprobe.enable` (HAL_BOOL):: Measurement enabled or not tool. Reflects screen button state. +`qtversaprobe.blockheight` (HAL_REAL):: The measured height of the top face of the workpiece. Reflects screen entry. +`qtversaprobe.probeheight` (HAL_REAL):: The toolsetter probe switch height. Reflects screen entry. +`qtversaprobe.searchvel` (HAL_REAL):: The velocity to search for the tool probe switch +`qtversaprobe.probevel` (HAL_REAL):: The velocity to probe tool length. Reflects screen entry. +`qtversaprobe.backoffdist` (HAL_REAL):: The distance the probe backs off after triggering. Reflects screen entry. === Tool Measurement INI File Modifications diff --git a/docs/src/gui/qtvcp-code-snippets.adoc b/docs/src/gui/qtvcp-code-snippets.adoc index 814d71e0627..9ffd6ae9d9b 100644 --- a/docs/src/gui/qtvcp-code-snippets.adoc +++ b/docs/src/gui/qtvcp-code-snippets.adoc @@ -287,7 +287,7 @@ Under the `initialized__` function, make sure there is an entry similar to this: # the widgets are instantiated. # the HAL pins are built but HAL is not set ready def initialized__(self): - self.pin_cycle_start_in = QHAL.newPin('cycle-start-in',QHAL.HAL_BIT, QHAL.HAL_IN) + self.pin_cycle_start_in = QHAL.newPin('cycle-start-in',QHAL.HAL_BOOL, QHAL.HAL_IN) self.pin_cycle_start_in.pinValueChanged.connect(lambda o,s: self.cycleStart(s)) ---- diff --git a/docs/src/gui/qtvcp-libraries.adoc b/docs/src/gui/qtvcp-libraries.adoc index 1f8965d1521..35f13e93f3d 100644 --- a/docs/src/gui/qtvcp-libraries.adoc +++ b/docs/src/gui/qtvcp-libraries.adoc @@ -399,10 +399,10 @@ These are the functions that can be called on the Qhal object: === Constants Here are the available constants: -* *HAL_BIT* -* *HAL_FLOAT* -* *HAL_S32* -* *HAL_U32* +* *HAL_BOOL* +* *HAL_REAL* +* *HAL_SINT* +* *HAL_UINT* * *HAL_IN* * *HAL_OUT* @@ -456,7 +456,7 @@ QHAL = Qhal() # the widgets are instantiated. # the HAL pins are built but HAL is not set ready def initialized__(self): - self.pin_button_in = QHAL.newpin('cycle-start-in',QHAL.HAL_BIT, QHAL.HAL_IN) + self.pin_button_in = QHAL.newpin('cycle-start-in',QHAL.HAL_BOOL, QHAL.HAL_IN) self.pin_button_in.pinValuechanged.connect(self.buttonChanged) self.pin_button_in.isDrivenChanged.connect(lambda p,s: self.buttonDriven(p,s)) diff --git a/docs/src/gui/qtvcp-vcp-panels.adoc b/docs/src/gui/qtvcp-vcp-panels.adoc index cd46a6d216f..7e544b46a9f 100644 --- a/docs/src/gui/qtvcp-vcp-panels.adoc +++ b/docs/src/gui/qtvcp-vcp-panels.adoc @@ -131,7 +131,7 @@ The Python handler file also provides a useful template for any custom panel. [[sub:qtvcp:panels:test-dial]] === `test_dial` -- This panel has a *dial that adjusts S32 and Float HAL output pins*. +- This panel has a *dial that adjusts SINT and REAL HAL output pins*. - The dial's range can be adjusted from a drop down menu. - The output can be scaled with the `spinbox`. - A `combobox` can be used to automatically select and connect to a signal. diff --git a/docs/src/gui/qtvcp-vismach.adoc b/docs/src/gui/qtvcp-vismach.adoc index 472cbc817db..75d04b065d6 100644 --- a/docs/src/gui/qtvcp-vismach.adoc +++ b/docs/src/gui/qtvcp-vismach.adoc @@ -128,8 +128,8 @@ Originally the vismach library required creating a component and connecting HAL [source,python] ---- c = hal.component("samplegui") -c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint0", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) c.ready() ---- @@ -412,8 +412,8 @@ Sets the _display color of the part based on a designated HAL bit pin state_. + if hal_comp is 'None' then this must be the full name of a system pin other wise this is the pin name excluding the component name. === HALColorRGB -Sets the _display color of the part based on a designated HAL U32 pin value_. + -The color is decoded from the U32 value. each color is a 0-255 decimal value (shown here in hex) + +Sets the _display color of the part based on a designated HAL UINT pin value_. + +The color is decoded from the UINT value. each color is a 0-255 decimal value (shown here in hex) + red = 0xXXXXXXRR + green = 0xXXXXGGXX + blue = 0xXXBBXXXX + @@ -423,7 +423,7 @@ combined as 0xXXBBGGRR + `hal_comp`;; The _HAL component Object_ or None. + In QtVCP if you are reading _system pins_ directly, then the component argument is set to `None`. + - `hal_pin`;; The _name of the U32 HAL IN pin_ that will change the color. + + `hal_pin`;; The _name of the UINT HAL IN pin_ that will change the color. + if hal_comp is 'None' then this must be the full name of a system pin other wise this is the pin name excluding the component name. + `alpha=`;; Sets the opacity. (0-1.0) @@ -470,7 +470,7 @@ Some of the available HalHUD function: + [source,python] ---- -comp.newpin("hide-chuck", hal.HAL_BIT, hal.HAL_IN) +comp.newpin("hide-chuck", hal.Type.BOOL, hal.Dir.IN) # chuckassembly = HideCollection([chuckassembly],comp,'hide-chuck') # also can be used like this @@ -569,7 +569,7 @@ STATUS = Status() # create HAL pins here if needed #c = hal.component("samplegui") -#c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN) +#c.newpin("joint0", hal.Type.REAL, hal.Dir.IN) # create the floor, tool and work floor = Box(-50, -50, -3, 50, 50, 0) diff --git a/docs/src/gui/qtvcp-widgets.adoc b/docs/src/gui/qtvcp-widgets.adoc index 74131236b2a..7d6581c1311 100644 --- a/docs/src/gui/qtvcp-widgets.adoc +++ b/docs/src/gui/qtvcp-widgets.adoc @@ -193,8 +193,8 @@ HalBar is a subclass of the Bar widget, so it inherits these properties: + * 'pinType': to select *HAL pins type*: ** `NONE` no HAL pin will be added -** `S32` A S32 integer pin will be added -** `FLOAT` A Float pin will be added +** `SINT` A SINT integer pin will be added +** `REAL` A Float pin will be added * 'pinName': to change the *HAL pin name* otherwise the widget base name is used. @@ -221,7 +221,7 @@ image::images/qtvcp_HALPad.png["QtVCP HALPad: HAL Buttons Joypad ",scale="25%"] This widget looks and acts like a *5 buttons D-pad*, with an LED ring. -Each button has an selectable type (Bit, S32 or Float) output HAL pin. +Each button has an selectable type (BOOL, SINT or REAL) output HAL pin. The LED center ring has selectable colors for off and on and is controlled by a bit HAL pin. @@ -240,9 +240,9 @@ There are _enumerated constants_ used: * For *HAL pins type*: ** `NONE` -** `BIT` -** `S32` -** `FLOAT` +** `BOOL` +** `SINT` +** `REAL` You use the widget name in Qt Designer plus the reference constant: @@ -259,9 +259,9 @@ self.w.halpadname.set_highlight(self.w.halpadname.LEFTRIGHT) Selection can be set in Qt Designer: + ** `NONE` -** `BIT` -** `S32` -** `FLOAT` +** `BOOL` +** `SINT` +** `REAL` //FIXME Does this really need to be repeated ? @@ -306,7 +306,7 @@ This widget *displays values sent to it*. Values can be sent from: * _HAL pins_ + - The input pin can be selected as Bit, S32, Float or no pin selected + The input pin can be selected as BOOL, SINT, REAL or no pin selected * _Programmatically_ * _A `QtSignal`_ @@ -363,14 +363,14 @@ You must set the *`digitCount`* property to an appropriate setting to display th Option string to be used as the HAL pin name. + If set to an empty string the widget name will be used. *`bit_pin_type`*:: - Selects the input pin as type BIT. + Selects the input pin as type `BOOL`. *`s32_pin_type`*:: - Selects the input pin as type S32. + Selects the input pin as type `SINT`. *`float_pin_type`*:: - Select the input pin as type `FLOAT`. + Select the input pin as type `REAL`. *`floatTemplate`*:: A string that will be used as a Python3 format template to tailor the LCD display. + - Only used when a `FLOAT` pin is selected, e.g., `{:.2f}` will display a float rounded to 2 numbers after the decimal. + + Only used when a `REAL` pin is selected, e.g., `{:.2f}` will display a float rounded to 2 numbers after the decimal. + A blank setting will allow the decimal to move as required. It is based on PyQt's _QLCDNumber_. @@ -3338,8 +3338,8 @@ from qtvcp.widgets.hal_selectionbox import HALSelectionBox # combo box for HAL pin selection combobox = HALSelectionBox() combobox.setShowTypes([combobox.PINS,combobox.SIGNALS]) - combobox.setPinTypes([combobox.HAL_BIT], direction = [combobox.HAL_IN]) - combobox.setSignalTypes([combobox.HAL_BIT], driven = [False,True]) + combobox.setPinTypes([combobox.HAL_BOOL], direction = [combobox.HAL_IN]) + combobox.setSignalTypes([combobox.HAL_BOOL], driven = [False,True]) combobox.hal_init() combobox.selectionUpdated.connect(lambda w: self.signalSelected(w)) @@ -3355,13 +3355,13 @@ There are function calls # set the list of types to show from: PINS SIGNALS combobox.setShowTypes([combobox.PINS]) -# set the pin types to show: HAL_BIT,HAL_FLOAT,HAL_S32,HAL_U32 +# set the pin types to show: HAL_BOOL,HAL_REAL,HAL_SINT,HAL_UINT # and a list of directions: HAL_IN HAL_OUT -combobox.setPinTypes(types=[combobox.HAL_BIT], direction = [HAL_IN]) +combobox.setPinTypes(types=[combobox.HAL_BOOL], direction = [HAL_IN]) -# set the signal types to show: HAL_BIT,HAL_FLOAT,HAL_S32,HAL_U32 +# set the signal types to show: HAL_BOOL,HAL_REAL,HAL_SINT,HAL_UINT # and a list of driven/undriven (by a connected pin) to show -combobox.setSignalTypes( types=[combobox.HAL_BIT], driven = [True,True]) +combobox.setSignalTypes( types=[combobox.HAL_BOOL], driven = [True,True]) ---- // vim: set syntax=asciidoc: diff --git a/docs/src/gui/qtvcp.adoc b/docs/src/gui/qtvcp.adoc index b1ce272a0f2..751745eeb4e 100644 --- a/docs/src/gui/qtvcp.adoc +++ b/docs/src/gui/qtvcp.adoc @@ -267,10 +267,10 @@ class UserHandlerClass(HandlerClass): super().init_pins() # add jog pins X axis - pin = QHAL.newpin("jog.axis.jog-x-plus", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newpin("jog.axis.jog-x-plus", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.value_changed.connect(lambda s: self.kb_jog(s, 0, 1, fast = False, linear = True)) - pin = QHAL.newpin("jog.axis.jog-x-minus", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newpin("jog.axis.jog-x-minus", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.value_changed.connect(lambda s: self.kb_jog(s, 0, -1, fast = False, linear = True)) ---- @@ -379,7 +379,7 @@ def new_pin_changed(data): # Here we used the function to add a bit input pin with a callback. def after_override__(self): try: - pin = hdlr.QHAL.newpin("new_pin", hdlr.QHAL.HAL_BIT, hdlr.QHAL.HAL_IN) + pin = hdlr.QHAL.newpin("new_pin", hdlr.QHAL.HAL_BOOL, hdlr.QHAL.HAL_IN) pin.value_changed.connect(new_pin_changed) except Exception as e: print(e) diff --git a/docs/src/gui/vismach.adoc b/docs/src/gui/vismach.adoc index 559e59d16f0..f67066b08a7 100644 --- a/docs/src/gui/vismach.adoc +++ b/docs/src/gui/vismach.adoc @@ -58,8 +58,8 @@ the Vismach model. [source,python] ---- c = hal.component("samplegui") -c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint0", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) c.ready() ---- @@ -285,7 +285,7 @@ from vismach import * import hal #create the HAL component and pins comp = hal.component("compname") -comp.newpin("pin_name", hal.HAL_FLOAT, hal.HAL_IN) +comp.newpin("pin_name", hal.Type.REAL, hal.Dir.IN) ... #create the floor, tool and work floor = Box(-50, -50, -3, 50, 50, 0) diff --git a/docs/src/hal/basic-hal.adoc b/docs/src/hal/basic-hal.adoc index 5cf2078d30b..d0381de85a1 100644 --- a/docs/src/hal/basic-hal.adoc +++ b/docs/src/hal/basic-hal.adoc @@ -57,7 +57,7 @@ halcmd: loadrt or2 halcmd: show function Exported Functions: Owner CodeAddr Arg FP Users Name - 00004 f8bc5000 f8f950c8 NO 0 or2.0 + 00004 f8bc5000 f8f950c8 YES 0 or2.0 ---- You have to add a function from a HAL real time component to a thread to get the function to update at the rate of the thread. @@ -65,9 +65,9 @@ Usually there are two threads as shown in this example. [NOTE] ==== -The `FP` column and the `uses_fp` parameter are deprecated. -All threads now unconditionally save and restore floating point state. -The `fp`/`nofp` distinction will be removed in a future version. +The `FP` column always shows 'YES' and will be removed in the future. +All threads unconditionally save and restore floating point state. +The old `fp`/`nofp` distinction has been removed. ==== ---- @@ -235,7 +235,7 @@ It is an error if: * If the signal already has a writer * If value is not the correct type for the signal -[[sub:hal-inlinkp]] +[[sub:hal-unlinkp]] === unlinkp (((HAL unlinkp,unlinkp))) @@ -286,13 +286,13 @@ linkps parport.0.pin-02-out X-Step ==== newsig the command `newsig` creates a new HAL signal by the name __ and the data type of __. -Type must be 'bit', 's32', 'u32', 's64', 'u64' or 'float'. Error if __ already exists. +Type must be 'bool', 'sint', 'uint' or 'real'. Error if __ already exists. .Syntax and Examples of `newsig` [source,hal] ---- newsig -newsig Xstep bit +newsig Xstep bool ---- More information can be found in the HAL manual or the man pages for `halrun`. @@ -302,59 +302,42 @@ More information can be found in the HAL manual or the man pages for `halrun`. (((HAL Data))) -[[sub:hal-bit]] -=== Bit +[[sub:hal-bool]] +=== bool -(((HAL Bit,bit))) -A bit value is an on or off. +(((HAL bool,bool))) +A bool value is an on or off. -- bit values = true or 1 and false or 0 (True, TRUE, true are all valid) +- bool values = true or 1 and false or 0 (True, TRUE, true are all valid) -[[sub:hal-float]] -=== Float +[[sub:hal-real]] +=== real -(((HAL Float,float))) -A 'float' is a floating point number. +(((HAL real,real))) +A 'real' is a floating point number. In other words the decimal point can move as needed. -- float values = a 64 bit floating point value, with approximately 53 bits of resolution and over 2^10^ (~ 1000) bits of dynamic range. +- real values = a double precision floating point value, with approximately 53 bits of resolution and over 2^10^ (~ 1000) bits of dynamic range. For more information on floating point numbers see: https://en.wikipedia.org/wiki/Floating_point[https://en.wikipedia.org/wiki/Floating_point] -[[sub:hal-s32]] -=== s32 +[[sub:hal-sint]] +=== sint -(((HAL s32,s32))) -An 's32' number is a whole number that can have a negative or positive value. +(((HAL sint,sint))) +An 'sint' number is a whole number that can have a negative or positive value. -- s32 values = integer numbers from -2147483648 to 2147483647 +- sint values = integer numbers from -9223372036854775808 to 9223372036854775807 -[[sub:hal-u32]] -=== u32 +[[sub:hal-uint]] +=== uint -(((HAL u32,u32))) -A 'u32' number is a whole number that is positive only. +(((HAL uint,uint))) +A 'uint' number is a whole number that is positive only. -- u32 values = integer numbers from 0 to 4294967295 - -[[sub:hal-s64]] -=== s64 - -(((HAL s64,s64))) -An 's64' number is a whole number that can have a negative or positive value. - -- s64 values = integer numbers from -9,223,372,036,854,775,808 to - +9,223,372,036,854,775,807 - -[[sub:hal-u64]] -=== u64 - -(((HAL u64,u64))) -A 'u64' number is a whole number that is positive only. - -- u64 values = integer numbers from 0 to 18,446,744,073,709,551,615 +- uint values = integer numbers from 0 to 18446744073709551615 [[sec:hal-files]] == HAL Files @@ -412,9 +395,9 @@ and2.n .Pins ---- -and2.N.in0 (bit, in) -and2.N.in1 (bit, in) -and2.N.out (bit, out) +and2.N.in0 (bool, in) +and2.N.in1 (bool, in) +and2.N.out (bool, out) ---- .Truth Table of `and2` @@ -431,7 +414,7 @@ and2.N.out (bit, out) === not (((HAL not,not))) -The `not` component is a bit inverter. +The `not` component is a boolean inverter. .Syntax ---- @@ -446,8 +429,8 @@ not.n .Pins ---- -not.n.in (bit, in) -not.n.out (bit, out) +not.n.in (bool, in) +not.n.out (bool, out) ---- .Truth Table of `not` @@ -476,9 +459,9 @@ or2.n .Pins ---- -or2.n.in0 (bit, in) -or2.n.in1 (bit, in) -or2.n.out (bit, out) +or2.n.in0 (bool, in) +or2.n.in1 (bool, in) +or2.n.out (bool, out) ---- .or2 Truth Table @@ -509,9 +492,9 @@ xor2.n .Pins ---- -xor2.n.in0 (bit, in) -xor2.n.in1 (bit, in) -xor2.n.out (bit, out) +xor2.n.in0 (bool, in) +xor2.n.in1 (bool, in) +xor2.n.out (bool, out) ---- .xor2 Truth Table @@ -539,9 +522,9 @@ net both-on parport.0.pin-14-out <= and2.0.out ---- In the above example one copy of `and2` is loaded into real time space and added to the servo thread. -Next `pin-11` of the parallel port is connected to the `in0` bit of the and gate. -Next `pin-12` is connected to the `in1` bit of the and gate. -Last we connect the `and2` out bit to the parallel port `pin-14`. +Next `pin-11` of the parallel port is connected to the `in0` input of the and gate. +Next `pin-12` is connected to the `in1` output of the and gate. +Last we connect the `and2` output to the parallel port `pin-14`. So following the truth table for `and2` if pin 11 and pin 12 are on then the output pin 14 will be on. [[sec:hal-conversion-components]] @@ -553,10 +536,10 @@ So following the truth table for `and2` if pin 11 and pin 12 are on then the out === weighted_sum (((HAL weighted_sum,weighted_sum))) -The weighted sum converts a group of bits into an integer. -The conversion is the sum of the 'weights' of the bits present plus any offset. +The weighted sum converts a group of booleans into an integer. +The conversion is the sum of the 'weights' of the booleans present plus any offset. It's similar to 'binary coded decimal' but with more options. -The 'hold' bit interrupts the input processing, so that the 'sum' value no longer changes. +The 'hold' input interrupts the input processing, so that the 'sum' value no longer changes. .Syntax for loading component `weighted_sum` [source,hal] @@ -564,7 +547,7 @@ The 'hold' bit interrupts the input processing, so that the 'sum' value no longe loadrt weighted_sum wsum_sizes=size[,size,...] ---- -Creates groups of ``weighted_sum``s, each with the given number of input bits (size). +Creates groups of ``weighted_sum``s, each with the given number of input booleans (size). To update the `weighted_sum`, the `process_wsums` must be attached to a thread. @@ -576,24 +559,24 @@ addf process_wsums servo-thread Which updates the `weighted_sum` component. -In the following example, a copy of the AXIS HAL configuration window, bits '0' and '2' are TRUE, they have no offset. -The weight ('weight') of bit 0 is 1, that of bit 2 is 4, so the sum is 5. +In the following example, a copy of the AXIS HAL configuration window, bools '0' and '2' are TRUE, they have no offset. +The weight ('weight') of bool 0 is 1, that of bool 2 is 4, so the sum is 5. .Component pins of `weighted_sum` [width="90%",options="header"] |=== |Owner |Type |Dir |Value |Name -|10 |bit |In |TRUE m|wsum.0.bit.0.in -|10 |s32 |I/O |1 m|wsum.0.bit.0.weight -|10 |bit |In |FALSE m|wsum.0.bit.1.in -|10 |s32 |I/O |2 m|wsum.0.bit.1.weight -|10 |bit |In |TRUE m|wsum.0.bit.2.in -|10 |s32 |I/O |4 m|wsum.0.bit.2.weight -|10 |bit |In |FALSE m|wsum.0.bit.3.in -|10 |s32 |I/O |8 m|wsum.0.bit.3.weight -|10 |bit |In |FALSE m|wsum.0.hold -|10 |s32 |I/O |0 m|wsum.0.offset -|10 |s32 |Out |5 m|wsum.0.sum +|10 |bool |In |TRUE m|wsum.0.bit.0.in +|10 |sint |I/O |1 m|wsum.0.bit.0.weight +|10 |bool |In |FALSE m|wsum.0.bit.1.in +|10 |sint |I/O |2 m|wsum.0.bit.1.weight +|10 |bool |In |TRUE m|wsum.0.bit.2.in +|10 |sint |I/O |4 m|wsum.0.bit.2.weight +|10 |bool |In |FALSE m|wsum.0.bit.3.in +|10 |sint |I/O |8 m|wsum.0.bit.3.weight +|10 |bool |In |FALSE m|wsum.0.hold +|10 |sint |I/O |0 m|wsum.0.offset +|10 |sint |Out |5 m|wsum.0.sum |=== // vim: set syntax=asciidoc: diff --git a/docs/src/hal/comp.adoc b/docs/src/hal/comp.adoc index aa6d5816bb5..19b5b4492ca 100644 --- a/docs/src/hal/comp.adoc +++ b/docs/src/hal/comp.adoc @@ -24,15 +24,14 @@ The equivalent component is very short when written using the 'halcompile' prepr .Simple Component Example ---- component ddt "Compute the derivative of the input function"; -pin in float in; -pin out float out; -variable double old; -option period no; +pin in real in; +pin out real out; +variable rtapi_real old; function _; license "GPL"; // indicates GPL v2 or later ;; -float tmp = in; -out = (tmp - old) / fperiod; +rtapi_real tmp = in; +out_set((tmp - old) / fperiod); old = tmp; ---- @@ -75,7 +74,7 @@ placing `rtexample.ko` in the LinuxCNC realtime module directory: sudo (for root permission) is needed when using LinuxCNC from a deb package install. When using a Run-In-Place (RIP) build, root privileges should not be needed. -Or, it can process and compile in one step, leaving `example.ko` (or `example.so` for the simulator) in the current directory: +Or, it can process and compile in one step, leaving `example.ko` (or `example.so` for uspace) in the current directory: ---- halcompile --compile rtexample.comp @@ -181,6 +180,7 @@ Declarations include: * 'component HALNAME (DOC);' * 'pin PINDIRECTION TYPE HALNAME ([SIZE]|[MAXSIZE: CONDSIZE]) (if CONDITION) (= STARTVALUE) (DOC) ;' * 'param PARAMDIRECTION TYPE HALNAME ([SIZE]|[MAXSIZE: CONDSIZE]) (if CONDITION) (= STARTVALUE) (DOC) ;' +* 'alias HALNAME HALNAME ;' * 'function HALNAME (fp | nofp) (DOC);' * 'option OPT (VALUE);' * 'variable CTYPE STARREDNAME ([SIZE]);' @@ -253,37 +253,37 @@ better.""" + Or a string may be preceded by the literal character 'r', in which case the string is interpreted like a Python raw-string. + -The documentation string is in "groff -man" format. -For more information on this markup format, see 'groff_man(7)'. -Remember that 'halcompile' interprets backslash escapes in strings, so for instance to set the italic font for the word 'example', write: -+ ----- -"\\fIexample\\fB" ----- -+ -In this case, r-strings are particularly useful, because the backslashes in an r-string need not be doubled: -+ ----- -r"\fIexample\fB" ----- +The documentation string is in "asciidoc" format. +For more information on this markup format, see 'ascidoctor(1)' and https://asciidoctor.org. -* 'TYPE' - One of the HAL types: 'bit', 's32', 'u32', 's64', 'u64' or 'float'. - The names 'signed' and 'unsigned' may also be used for 's32' and 'u32' but 's32' and 'u32' are preferred. -* 'PINDIRECTION' - One of the following: 'in', 'out', or 'io'. - A component sets a value for an 'out' pin, it reads a value from an 'in' pin, and it may read or set the value of an 'io' pin. -* 'PARAMDIRECTION' - One of the following: 'r' or 'rw'. A component sets a value for a 'r' parameter, and it may read or set the value of a 'rw' parameter. +* 'TYPE' - One of the HAL types: `bool`, `sint`, `uint` or `real`. +* 'PINDIRECTION' - One of the following: `in`, `out`, or `io`. + A component sets a value for an 'out' pin, it reads a value from an `in` pin, and it may read or set the value of an `io` pin. +* 'PARAMDIRECTION' - One of the following: `r` or `rw`. A component sets a value for a 'r' parameter, and it may read or set the value of a 'rw' parameter. * 'STARTVALUE' - Specifies the initial value of a pin or parameter. - If it is not specified, then the default is '0' or 'FALSE', depending on the type of the item. + If it is not specified, then the default is `0` or `FALSE`, depending on the type of the item. * 'HEADERFILE' - The name of a header file, either in double-quotes (`include "myfile.h";`) or in angle brackets (`include ;`). The header file will be included (using C's #include) at the top of the file, before pin and parameter declarations. -=== HAL functions +[NOTE] +==== +Transitionally, `si32` and `ui32` are supported as pin and param types. +These read the lower 32-bit value (truncating!) and write 32-bit (properly sign-extended for the underlying type). +The underlying values are always correct. + +You should retire all 32-bit pins and params and upgrade to 'sint' and 'uint'. +Please beware of local variable truncation in the upgrade process. +The proper variable types matching for all HAL types are: -* 'fp' - Indicates that the function performs floating-point calculations. -* 'nofp' - Indicates that it only performs integer calculations. - If neither is specified, 'fp' is assumed. - Neither 'halcompile' nor gcc can detect the use of floating-point calculations in functions that are tagged 'nofp', - but the use of such operations results in undefined behavior. +[options="header"] +|=== +| HAL type | C type | Description +| `bool` | `rtapi_bool` | Boolean value +| `real` | `rtapi_real` | Floating point value +| `sint` | `rtapi_sint` | Signed integer value +| `uint` | `rtaip_uint` | Unsigned integer value +|=== +==== === Options @@ -318,7 +318,7 @@ The currently defined options are: When implementing your own `rtapi_app_main()`, call the function `int export(char *prefix, long extra_arg)` to register the pins, parameters, and functions for `prefix`. * 'option data TYPE' - (default: none) *deprecated* + - If specified, each instance of the component will have an associated data block of type 'TYPE' (which can be a simple type like 'float' or the name of a type created with 'typedef'). + If specified, each instance of the component will have an associated data block of type 'TYPE' (which can be a simple type like 'real' or the name of a type created with 'typedef'). In new components, 'variable' should be used instead. * 'option extra_setup yes' - (default: no) + @@ -403,7 +403,7 @@ This declaration is *required*. Declare a per-instance variable 'STARREDNAME' of type 'CTYPE', optionally as an array of 'SIZE' items, and optionally with a default value 'DEFAULT'. Items with no 'DEFAULT' are initialized to all-bits-zero. -'CTYPE' is a simple one-word C type, such as `float`, `u32`, `s32`, `int`, etc. +'CTYPE' is a simple one-word C type, such as `rtapi_real`, `rtapi_uint`, `rtapi_sint`, `int`, etc. Access to array variables uses square brackets. If a variable is to be of a pointer type, there may not be any space between the "*" and the variable name. @@ -444,7 +444,7 @@ Variable and function names that can not be used or are likely to cause problems == Convenience Macros Based on the items in the declaration section, 'halcompile' creates a C structure called `struct __comp_state`. -However, instead of referring to the members of this structure (e.g., `*(inst->name)`), +However, instead of referring to the members of this structure (e.g., `*(inst\->name)`), they will generally be referred to using the macros below. The details of `struct __comp_state` and these macros may change from one version of 'halcompile' to the next. @@ -554,13 +554,13 @@ The file name must match the component name. [source,c] ---- component constant; -pin out float out; -param r float value = 1.0; +pin out real out; +param r real value = 1.0; option period no; function _; license "GPL"; // indicates GPL v2 or later ;; -FUNCTION(_) { out = value; } +FUNCTION(_) { out_set(value); } ---- === sincos @@ -575,71 +575,77 @@ The HAL pins are still called 'sincos..sin'. [source,c] ---- component sincos; -pin out float sin_; -pin out float cos_; -pin in float theta; +pin out real sin_; +pin out real cos_; +pin in real theta; option period no; function _; license "GPL"; // indicates GPL v2 or later ;; #include -FUNCTION(_) { sin_ = sin(theta); cos_ = cos(theta); } +FUNCTION(_) { + sin__set(sin(theta)); + cos__set(cos(theta)); +} ---- === out8 This component is a driver for a 'fictional' card called "out8", which has 8 pins of digital output which are treated as a single 8-bit value. There can be a varying number of such cards in the system, and they can be at various addresses. -The pin is called 'out_' because 'out' is an identifier used in ''. -It illustrates the use of 'EXTRA_SETUP' and 'EXTRA_CLEANUP' to request an I/O region and then free it in case of error or when the module is unloaded. +The pin is called 'out_' because 'out' is an identifier used in ''. +It illustrates the use of 'POST_EXPORT' and 'EXTRA_CLEANUP' to request an I/O region and then free it in case of error or when the module is unloaded. [source,c] ---- component out8; -pin out unsigned out_ "Output value; only low 8 bits are used"; -param r unsigned ioaddr; +pin out uint out_ "Output value; only low 8 bits are used"; +param r uint ioaddr; function _; option period no; option count_function; -option extra_setup; +option post_export yes; option extra_cleanup; option constructable no; license "GPL"; // indicates GPL v2 or later ;; -#include +#include -#define MAX 8 -int io[MAX] = {0,}; -RTAPI_MP_ARRAY_INT(io, MAX, "I/O addresses of out8 boards"); +#define MAXOUT 8 +int io[MAXOUT] = {}; +RTAPI_MP_ARRAY_INT(io, MAXOUT, "I/O addresses of out8 boards"); int get_count(void) { int i = 0; - for(i=0; i0; i--) out(i) = out(i-1); -out(0) = in; +for(int i = 3; i > 0; i--) { + out_set(i, out(i-1)); +} +out_set(0, in); ---- === rand @@ -685,7 +692,7 @@ This non-realtime component changes the value on its output pin to a new random component rand; option userspace; -pin out float out; +pin out real out; license "GPL"; // indicates GPL v2 or later ;; #include @@ -693,7 +700,7 @@ license "GPL"; // indicates GPL v2 or later void user_mainloop(void) { while(1) { usleep(1000); - FOR_ALL_INSTS() out = drand48(); + FOR_ALL_INSTS() out_set(drand48()); } } ---- @@ -705,35 +712,40 @@ This realtime component shows how to use "personality" to create variable-size a [source,c] ---- component logic "LinuxCNC HAL component providing experimental logic functions"; -pin in bit in-##[16 : personality & 0xff]; -pin out bit and if personality & 0x100; -pin out bit or if personality & 0x200; -pin out bit xor if personality & 0x400; +pin in bool in-##[16 : personality & 0xff]; +pin out bool and if personality & 0x100; +pin out bool or if personality & 0x200; +pin out bool xor if personality & 0x400; option period no; -function _ nofp; +function _; description """ Experimental general 'logic function' component. Can perform 'and', 'or' and 'xor' of up to 16 inputs. Determine the proper value for 'personality' by adding: -.IP \\(bu 4 -The number of input pins, usually from 2 to 16 -.IP \\(bu -256 (0x100) if the 'and' output is desired -.IP \\(bu -512 (0x200) if the 'or' output is desired -.IP \\(bu -1024 (0x400) if the 'xor' (exclusive or) output is desired"""; + +* 4 - The number of input pins, usually from 2 to 16 +* 256 (0x100) - if the 'and' output is desired +* 512 (0x200) - if the 'or' output is desired +* 1024 (0x400) - if the 'xor' (exclusive or) output is desired + +"""; license "GPL"; // indicates GPL v2 or later ;; FUNCTION(_) { - int i, a=1, o=0, x=0; - for(i=0; i < (personality & 0xff); i++) { - if(in(i)) { o = 1; x = !x; } - else { a = 0; } + rtapi_bool a = 1; + rtapi_bool o = 0; + rtapi_bool x = 0; + for(int i = 0; i < (personality & 0xff); i++) { + if(in(i)) { + o = 1; + x = !x; + } else { + a = 0; + } } - if(personality & 0x100) and = a; - if(personality & 0x200) or = o; - if(personality & 0x400) xor = x; + if(personality & 0x100) and_set(a); + if(personality & 0x200) or_set(o); + if(personality & 0x400) xor_set(x); } ---- @@ -758,9 +770,9 @@ It also shows how to pass reference of HAL pins to those functions. [source,c] ---- component example; -pin in s32 in; -pin out bit out1; -pin out bit out2; +pin in sint in; +pin out bool out1; +pin out bool out2; option period no; function _; @@ -768,31 +780,32 @@ license "GPL"; ;; // general pin set true function -void set(hal_bit_t *p){ - *p = 1; +void doset(hal_bool_t p) { + hal_set_bool(p, 1); } // general pin set false function -void unset(hal_bit_t *p){ - *p = 0; +void unset(hal_bool_t p) { + hal_set_bool(p, 0); } //main function FUNCTION(_) { - if (in < 0){ - set(&out1); - unset(&out2); - }else if (in >0){ - unset(&out2); - set(&out2); - }else{ - unset(&out1); - unset(&out2); + rtapi_sint inval = in; + if (inval < 0) { + doset(out1_ptr); + unset(out2_ptr); + } else if (inval > 0) { + unset(out1_ptr); + doset(out2_ptr); + } else { + unset(out1_ptr); + unset(out2_ptr); } } ---- -This component uses two general function to manipulate a HAL bit pin referenced to it. +This component uses two general function to manipulate a HAL bool pin referenced to it. == Command Line Usage diff --git a/docs/src/hal/components.adoc b/docs/src/hal/components.adoc index e613c18749c..d779220b35e 100644 --- a/docs/src/hal/components.adoc +++ b/docs/src/hal/components.adoc @@ -223,8 +223,7 @@ To search in the man pages, use the UNIX tool `apropos`. ==== Arithmetic and float [{tab_options}] |=== -| link:../man/man9/abs_s32.9.html[abs_s32] |Computes the absolute value and sign of a integer input signal || -| link:../man/man9/abs_s64.9.html[abs_s64] |Computes the absolute value and sign of a 64 bit integer input signal || +| link:../man/man9/abs_sint.9.html[abs_sint] |Computes the absolute value and sign of a integer input signal || | link:../man/man9/abs.9.html[abs] |Computes the absolute value and sign of a float input signal || | link:../man/man9/biquad.9.html[biquad] |Biquad IIR filter | | | link:../man/man9/blend.9.html[blend] |Perform linear interpolation between two values || @@ -258,7 +257,7 @@ Limit its slew rate to less than maxv per second. Limit its second derivative to | link:../man/man9/offset.9.html[offset] |Adds an offset to an input, and subtracts it from the feedback value. || | link:../man/man9/safety_latch.9.html[safety_latch] |latch for error signals || | link:../man/man9/sample_hold.9.html[sample_hold] | Sample and Hold. || -| link:../man/man9/scaled_s32_sums.9.html[scaled_s32_sums] |Sum of four inputs (each with a scale) || +| link:../man/man9/scaled_sint_sums.9.html[scaled_sint_sums] |Sum of four inputs (each with a scale) || | link:../man/man9/scale.9.html[scale] |Applies a scale and offset to its input. || | link:../man/man9/sum2.9.html[sum2] |Sum of two inputs (each with a gain) and an offset. || | link:../man/man9/time.9.html[time] | Accumulated run-time timer counts HH:MM:SS of 'active' input. || @@ -286,35 +285,18 @@ Limit its slew rate to less than maxv per second. Limit its second derivative to | link:../man/man9/bin2gray.9.html[bin2gray] |Converts a number to the gray-code representation || | link:../man/man9/bitmerge.9.html[bitmerge] |Converts individual input bits into an unsigned-32 || | link:../man/man9/bitslice.9.html[bitslice] |Converts an unsigned-32 input into individual bits || -| link:../man/man9/conv_bit_float.9.html[conv_bit_float] |Converts from bit to float || -| link:../man/man9/conv_bit_s32.9.html[conv_bit_s32] |Converts from bit to s32 || -| link:../man/man9/conv_bit_u32.9.html[conv_bit_u32] |Converts from bit to u32 || -| link:../man/man9/conv_float_s32.9.html[conv_float_s32] |Converts from float to s32 || -| link:../man/man9/conv_float_u32.9.html[conv_float_u32] |Converts from float to u32 || -| link:../man/man9/conv_s32_bit.9.html[conv_s32_bit] |Converts from s32 to bit || -| link:../man/man9/conv_s32_float.9.html[conv_s32_float] |Converts from s32 to float || -| link:../man/man9/conv_s32_u32.9.html[conv_s32_u32] |Converts from s32 to u32 || -| link:../man/man9/conv_u32_bit.9.html[conv_u32_bit] |Converts from u32 to bit || -| link:../man/man9/conv_u32_float.9.html[conv_u32_float] |Converts from u32 to float || -| link:../man/man9/conv_u32_s32.9.html[conv_u32_s32] |Converts from u32 to s32 || -| link:../man/man9/conv_bit_s64.9.html[conv_bit_s64] |Convert a value from bit to s64 || -| link:../man/man9/conv_bit_u64.9.html[conv_bit_u64] |Convert a value from bit to u64 || -| link:../man/man9/conv_float_s64.9.html[conv_float_s64] |Convert a value from float to s64 || -| link:../man/man9/conv_float_u64.9.html[conv_float_u64] |Convert a value from float to u64 || -| link:../man/man9/conv_s32_s64.9.html[conv_s32_s64] |Convert a value from s32 to s64 || -| link:../man/man9/conv_s32_u64.9.html[conv_s32_u64] |Convert a value from s32 to u64 || -| link:../man/man9/conv_s64_bit.9.html[conv_s64_bit] |Convert a value from s64 to bit || -| link:../man/man9/conv_s64_float.9.html[conv_s64_float] |Convert a value from s64 to float || -| link:../man/man9/conv_s64_s32.9.html[conv_s64_s32] |Convert a value from s64 to s32 || -| link:../man/man9/conv_s64_u32.9.html[conv_s64_u32] |Convert a value from s64 to u32 || -| link:../man/man9/conv_s64_u64.9.html[conv_s64_u64] |Convert a value from s64 to u64 || -| link:../man/man9/conv_u32_s64.9.html[conv_u32_s64] |Convert a value from u32 to s64 || -| link:../man/man9/conv_u32_u64.9.html[conv_u32_u64] |Convert a value from u32 to u64 || -| link:../man/man9/conv_u64_bit.9.html[conv_u64_bit] |Convert a value from u64 to bit || -| link:../man/man9/conv_u64_float.9.html[conv_u64_float] |Convert a value from u64 to float || -| link:../man/man9/conv_u64_s32.9.html[conv_u64_s32] |Convert a value from u64 to s32 || -| link:../man/man9/conv_u64_s64.9.html[conv_u64_s64] |Convert a value from u64 to s64 || -| link:../man/man9/conv_u64_u32.9.html[conv_u64_u32] |Convert a value from u64 to u32 || +| link:../man/man9/conv_bool_real.9.html[conv_bool_real] |Converts from bool to real || +| link:../man/man9/conv_bool_sint.9.html[conv_bool_sint] |Convert a value from bool to sint || +| link:../man/man9/conv_bool_uint.9.html[conv_bool_uint] |Convert a value from bool to uint || +| link:../man/man9/conv_real_bool.9.html[conv_real_bool] |Convert a value from real to bool || +| link:../man/man9/conv_real_sint.9.html[conv_real_sint] |Convert a value from real to sint || +| link:../man/man9/conv_real_uint.9.html[conv_real_uint] |Convert a value from real to uint || +| link:../man/man9/conv_sint_bool.9.html[conv_sint_bool] |Convert a value from sint to bool || +| link:../man/man9/conv_sint_real.9.html[conv_sint_real] |Convert a value from sint to real || +| link:../man/man9/conv_sint_uint.9.html[conv_sint_uint] |Convert a value from sint to uint || +| link:../man/man9/conv_uint_bool.9.html[conv_uint_bool] |Convert a value from uint to bool || +| link:../man/man9/conv_uint_real.9.html[conv_uint_real] |Convert a value from uint to real || +| link:../man/man9/conv_uint_sint.9.html[conv_uint_sint] |Convert a value from uint to sint || | link:../man/man9/gray2bin.9.html[gray2bin] |Converts gray-code input to binary || |=== diff --git a/docs/src/hal/halmodule.adoc b/docs/src/hal/halmodule.adoc index df71e342335..086cc5a5fe8 100644 --- a/docs/src/hal/halmodule.adoc +++ b/docs/src/hal/halmodule.adoc @@ -18,8 +18,8 @@ The following component copies the value seen on its input pin ('passthrough.in' import hal import time h = hal.component("passthrough") -h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("out", hal.HAL_FLOAT, hal.HAL_OUT) +h.newpin("in", hal.Type.REAL, hal.Dir.IN) +h.newpin("out", hal.Type.REAL, hal.Dir.OUT) h.ready() try: while True: @@ -80,8 +80,8 @@ If the prefix is not specified, the component name is used. .Create a HAL pin or parameter [source,python] ---- -mycomp.newpin("in", hal.HAL_FLOAT, hal.HAL_IN) -mycomp.newparam("has-feature-rotate", hal.HAL_BIT, hal.HAL_RO) +mycomp.newpin("in", hal.Type.REAL, hal.Dir.IN) +mycomp.newparam("has-feature-rotate", hal.Type.BOOL, hal.Dir.RO) ---- Then pins are created by calls to methods on the component object. @@ -91,14 +91,14 @@ For parameters, the arguments are: parameter name suffix, parameter type, and pa .HAL Option Names [width="100%",cols="<3s,7*<"] |=== -|Pin and Parameter Types:|`HAL_BIT`|`HAL_FLOAT`|`HAL_S32`|`HAL_U32`|`HAL_S64`|`HAL_U64`|`HAL_PORT` -|Pin Directions: |`HAL_IN` |`HAL_OUT` |`HAL_IO` | | | | -|Parameter Directions: |`HAL_RO` |`HAL_RW` | | | | | +|Pin and Parameter Types:|`hal.Type.BOOL`|`hal.Type.REAL`|`hal.Type.SINT`|`hal.Type.UINT`|`hal.Type.PORT` +|Pin Directions: |`hal.Dir.IN` |`hal.Dir.OUT` |`hal.Dir.IO` | | +|Parameter Directions: |`hal.Dir.RO` |`hal.Dir.RW` | | | |=== [NOTE] ==== -Only pins and signals can use the `HAL_PORT` type. +Only pins and signals can use the `hal.Type.PORT` type. ==== The full pin or parameter name is formed by joining the prefix and the @@ -145,7 +145,7 @@ mycomp.getpins() === Driving output (HAL_OUT) pins -Periodically, usually in response to a timer, all `HAL_OUT` pins should be "driven" by assigning them a new value. +Periodically, usually in response to a timer, all `hal.Dir.OUT` pins should be "driven" by assigning them a new value. This should be done whether or not the value is different than the last one assigned. When a pin is connected to a signal, its old output value is not copied into the signal. The proper value will only appear on the signal once the component assigns a new value. @@ -175,12 +175,10 @@ See <> for an overview and descr Use these to specify details rather then the value they hold. * Pin, parameter and signal types: -** `HAL_BIT` -** `HAL_FLOAT` -** `HAL_S32` -** `HAL_U32` -** `HAL_S64` -** `HAL_U64` +** `HAL_BOOL` +** `HAL_REAL` +** `HAL_SINT` +** `HAL_UINT` * Pin direction: ** `HAL_IN` ** `HAL_OUT` diff --git a/docs/src/hal/parallel-port.adoc b/docs/src/hal/parallel-port.adoc index 51e873b00e3..eb30acd1f06 100644 --- a/docs/src/hal/parallel-port.adoc +++ b/docs/src/hal/parallel-port.adoc @@ -205,7 +205,7 @@ The `-in-not` HAL pin is inverted and is FALSE if the physical pin is high. * `parport.`__

__`.pin-`____`-out-invert` (bit) Inverts an output pin. * `parport.`__

__`.pin-`____`-out-reset` (bit) (only for `-out` pins) TRUE if this pin should be reset when the `-reset` function is executed. -* `parport.`__

__`.reset-time` (U32) The time (in nanoseconds) between a pin is set by `-write` and reset by the `-reset` function if it is enabled. +* `parport.`__

__`.reset-time` (UINT) The time (in nanoseconds) between a pin is set by `-write` and reset by the `-reset` function if it is enabled. The `-invert` parameter determines whether an output pin is active high or active low. If `-invert` is FALSE, setting the HAL `-out` pin TRUE drives the physical pin high, and FALSE drives it low. diff --git a/docs/src/man/man1/halcompile.1.adoc b/docs/src/man/man1/halcompile.1.adoc index c06cd1b8688..a2d45589cc4 100644 --- a/docs/src/man/man1/halcompile.1.adoc +++ b/docs/src/man/man1/halcompile.1.adoc @@ -73,6 +73,8 @@ components. Extra arguments passed to the C-compiler. *--extra-link-args*=_args_:: Extra arguments passed to the linker. +*-w*,*--werror*:: +Treat warnings as errors. == DESCRIPTION diff --git a/docs/src/man/man1/mesambccc.1.adoc b/docs/src/man/man1/mesambccc.1.adoc index 04790753bbf..a5867515f4e 100644 --- a/docs/src/man/man1/mesambccc.1.adoc +++ b/docs/src/man/man1/mesambccc.1.adoc @@ -65,19 +65,19 @@ clamped to the acceptable range. A subset of the Modbus functions is supported (with function number in parentheses): * `R_COILS` (`1`): - Maps to 1..2000 HAL output pins of type 'HAL_BIT'. + Maps to 1..2000 HAL output pins of type 'HAL_BOOL'. * `R_INPUTS` (`2`): - Maps to 1..2000 HAL output pins of type 'HAL_BIT'. + Maps to 1..2000 HAL output pins of type 'HAL_BOOL'. * `R_REGISTERS` (`3`): Maps to 1..125 HAL output pins depending 'haltype' and 'scale' attributes. * `R_INPUTREGS` (`4`): Maps to 1..125 HAL output pins depending 'haltype' and 'scale' attributes. * `W_COIL` (`5`): - Maps to single HAL input pin of type 'HAL_BIT'. + Maps to single HAL input pin of type 'HAL_BOOL'. * `W_REGISTER` (`6`): Maps to single HAL input pins depending 'haltype' and 'scale' attributes. * `W_COILS` (`15`): - Maps to 1..2000 HAL input pins of type 'HAL_BIT'. + Maps to 1..2000 HAL input pins of type 'HAL_BOOL'. * `W_REGISTERS` (`16`): Maps to 1..125 HAL input pins depending 'haltype' and 'scale' attributes. @@ -395,20 +395,18 @@ Recognized '//' attributes: A '' in the '' section maps to one or more HAL pins with specific type using the 'haltype' attribute. Recognized are: -* 'HAL_BIT' -* 'HAL_FLOAT' -* 'HAL_S32' -* 'HAL_U32' -* 'HAL_S64' -* 'HAL_U64' +* 'BOOL', 'HAL_BOOL' +* 'REAL', 'HAL_REAL' +* 'SINT', 'HAL_SINT' +* 'UINT', 'HAL_UINT' The types are also recognized without the HAL_ prefix. Note that coil and binary input functions `R_COILS` (`1`), `R_INPUTS` (`2`), `W_COIL` (`5`) -and `W_COILS` (`15`) can only map to 'HAL_BIT' and do so implicitly. +and `W_COILS` (`15`) can only map to 'HAL_BOOL' and do so implicitly. -The 'HAL_BIT', 'HAL_U32' and 'HAL_U64' types always map to one single HAL pin. +The 'HAL_BOOL' and 'HAL_UINT' types always map to one single HAL pin. -The 'HAL_FLOAT', 'HAL_S32' and 'HAL_S64' types can generate one single pin or +The 'HAL_REAL' and 'HAL_SINT' types can generate one single pin or can generate multiple pins with 'offset' and 'scale'. Output pins with `R_REGISTERS` (`3`) and `R_INPUTREGS` (`4`) can add a 'scaled' pin to the set. @@ -416,10 +414,18 @@ the set. Mapping HAL pins to commands requires a 'modbustype' attribute to encode the format and necessary conversions. Register functions `R_REGISTERS` (`3`), `R_INPUTREGS` (`4`), `W_REGISTER` (`6`) and `W_REGISTERS` (`16`) may map -to 'HAL_BIT' only when using unsigned 'modbustype' where a value of zero (0) +to 'HAL_BOOL' only when using unsigned 'modbustype' where a value of zero (0) is _false_ and any other value is _true_ for write functions or one (1) for read functions. +[NOTE] +==== +The old 'haltype' values 'HAL_BIT', 'HAL_FLOAT', 'HAL_S32', 'HAL_U32', + 'HAL_S64' and 'HAL_U64' are still recognized for compatibility. They map to + 'HAL_BOOL', 'HAL_REAL', 'HAL_SINT', 'HAL_UINT', 'HAL_SINT' and 'HAL_UINT' +respectively. +==== + === The '' section defines one or more '' tags to describe the Modbus function(s) to execute in a periodical way. Each '' tag maps to @@ -448,14 +454,14 @@ writes at the specified interval. ---- - Type is implicit HAL_BIT, will become HAL pins: + Type is implicit HAL_BOOL, will become HAL pins: - (out) hm2_modbus.0.wavebox.state-00 - (out) hm2_modbus.0.wavebox.state-01 - (out) hm2_modbus.0.wavebox.state-02 - (out) hm2_modbus.0.wavebox.state-03 - Too much will kill you... @@ -469,7 +475,7 @@ writes at the specified interval. - Will create HAL_BIT pins: + Will create HAL_BOOL pins: - (in) hm2_modbus.0.anyandall-00 - (in) hm2_modbus.0.anyandall-01 The bcanswer flag signifies that a device erroneously sends a reply on @@ -478,10 +484,10 @@ writes at the specified interval. - - Will create a HAL_U32 pin + Will create a HAL_UINT pin - (in) hm2_modbus.0.watcher The 'count' is implicit 1. The data is mapped to U_AB and is clamped. The data is sent every time (resend=1), regardless whether the HAL pin @@ -533,7 +539,7 @@ Recognized '/' attributes: The HAL pin type for interactions. You do not need to specify this attribute for the Modbus functions read/write coil(s) or inputs, `R_COILS` (`1`), `R_INPUTS` (`2`), `W_COIL` (`5`) and `W_COILS` (`15`), as these always use - the 'HAL_BIT' type. + the 'HAL_BOOL' type. *interval* [once,0..3600000000]:: The command repeat interval in micro-seconds. This is the time between repeating this ''. An interval shorter than the time it takes to work @@ -564,12 +570,12 @@ Recognized '/' attributes: *scale* [Boolean]:: Add scaling HAL pins. Modbus read functions `R_REGISTERS` (`3`) and `R_INPUTREGS` (`4`) add extra HAL pins *pin.name.offset* (in, 64-bit 'haltype'), *pin.name.scale* - (in, 'HAL_FLOAT') and *pin.name.scaled* (out, 'HAL_FLOAT'). + + (in, 'HAL_REAL') and *pin.name.scaled* (out, 'HAL_REAL'). + The Modbus write functions `W_REGISTER` (`6`) and `W_REGISTERS` (`16`) create extra HAL pins *pin.name.offset* (in, 64-bit 'haltype') and *pin.name.scale* - (in, 'HAL_FLOAT'). + - The 'scale' attribute is only supported for 'HAL_FLOAT', 'HAL_S32' and 'HAL_S64'. - Default is true for 'HAL_FLOAT' and false for others. The *scale* pin is + (in, 'HAL_REAL'). + + The 'scale' attribute is only supported for 'HAL_REAL' and 'HAL_SINT'. + Default is true for 'HAL_REAL' and false for others. The *scale* pin is initialized to one (1.0) and the *offset* pin is initialized to zero (0). + Scaling is always multiplicative to prevent division-by-zero. The offset is always subtracted before scaling. The scaling action performed and subject to @@ -621,25 +627,25 @@ attributes and can be overridden by adding them to the '' tag. - + ---- diff --git a/docs/src/man/man3/hal_create_thread.3.adoc b/docs/src/man/man3/hal_create_thread.3.adoc index 9289803f210..dbbc8d258ce 100644 --- a/docs/src/man/man3/hal_create_thread.3.adoc +++ b/docs/src/man/man3/hal_create_thread.3.adoc @@ -12,7 +12,7 @@ hal_create_thread - Create a HAL thread ---- #include -int hal_create_thread(const char *name, unsigned long period, int uses_fp); +int hal_create_thread(const char *name, unsigned long period); int hal_thread_delete(const char *name); ---- @@ -22,9 +22,6 @@ name:: The name of the thread. period:: The interval, in nanoseconds, between iterations of the thread. -uses_fp:: - Deprecated and ignored. All threads now unconditionally save and restore - floating point state. This parameter will be removed in a future version. == DESCRIPTION diff --git a/docs/src/man/man3/hal_export_funct.3.adoc b/docs/src/man/man3/hal_export_funct.3.adoc index 3ff00485fab..484cefbd145 100644 --- a/docs/src/man/man3/hal_export_funct.3.adoc +++ b/docs/src/man/man3/hal_export_funct.3.adoc @@ -14,8 +14,8 @@ hal_export_funct, hal_export_functf - create a realtime function callable from a typedef void(*hal_funct_t)(void *arg, long period); -int hal_export_funct(const char *name, hal_funct_t funct, void *arg, int uses_fp, int reentrant, int comp_id); -int hal_export_functf(hal_funct_t funct, void *arg, int uses_fp, int reentrant, int comp_id, const char *fmt, ...); +int hal_export_funct(const char *name, hal_funct_t funct, void *arg, int reentrant, int comp_id); +int hal_export_functf(hal_funct_t funct, void *arg, int reentrant, int comp_id, const char *fmt, ...); ---- == ARGUMENTS @@ -26,9 +26,6 @@ funct:: The pointer to the function. arg:: The argument to be passed as the first parameter of _funct_. -uses_fp:: - Deprecated and ignored. All threads now unconditionally save and restore - floating point state. This parameter will be removed in a future version. reentrant:: If reentrant is non-zero, the function may be preempted and called again before the first call completes. Otherwise, it may only be added to one thread. diff --git a/docs/src/man/man3/rtapi_task_new.3.adoc b/docs/src/man/man3/rtapi_task_new.3.adoc index fd437d71172..5f22d802087 100644 --- a/docs/src/man/man3/rtapi_task_new.3.adoc +++ b/docs/src/man/man3/rtapi_task_new.3.adoc @@ -10,8 +10,7 @@ rtapi_task_new, rtapi_task_delete - create a realtime task [source,c] ---- -int rtapi_task_new(void (*_taskcode_)(void*), void *_arg_, int _prio_, - unsigned long _stacksize_, int _uses_fp_); +int rtapi_task_new(void (*_taskcode_)(void*), void *_arg_, int _prio_, unsigned long _stacksize_); int rtapi_task_delete(int _task_id_); ---- @@ -23,9 +22,6 @@ arg:: An argument to be passed to the _taskcode_ function when the task is started prio:: A task priority value returned by *rtapi_prio_xxxx* -uses_fp:: - Deprecated and ignored. All tasks now unconditionally save and restore - floating point state. This parameter will be removed in a future version. task_id:: A task ID returned by a previous call to *rtapi_task_new* diff --git a/docs/src/man/man9/motion.9.adoc b/docs/src/man/man9/motion.9.adoc index 43859fcef14..c49305905ad 100644 --- a/docs/src/man/man9/motion.9.adoc +++ b/docs/src/man/man9/motion.9.adoc @@ -105,47 +105,47 @@ digital pins and two analog pins. == MOTION PINS -*motion-command-handler.time* OUT S32:: +*motion-command-handler.time* OUT SINT:: Time (in ns) for the motion module motion-command-handler -*motion-controller.time* OUT S32:: +*motion-controller.time* OUT SINT:: Time (in ns) for the motion module motion-controller -*motion.adaptive-feed* IN FLOAT:: +*motion.adaptive-feed* IN REAL:: When adaptive feed is enabled with M52 P1, the commanded velocity is multiplied by this value. This effect is multiplicative with the NML-level feed override value and motion.feed-hold. Negative values are valid and will run the G-code path in reverse. -**motion.analog-in-**_NN_ IN FLOAT:: +**motion.analog-in-**_NN_ IN REAL:: These pins are used by M66 Enn wait-for-input mode. -**motion.analog-out-**_NN_ OUT FLOAT:: +**motion.analog-out-**_NN_ OUT REAL:: These pins are used by M67-68. -*motion.coord-error* OUT BIT:: +*motion.coord-error* OUT BOOL:: TRUE when motion has encountered an error, such as exceeding a soft limit -*motion.coord-mode* OUT BIT:: +*motion.coord-mode* OUT BOOL:: TRUE when motion is in "coordinated mode", as opposed to "teleop mode" -*motion.current-vel* OUT FLOAT:: +*motion.current-vel* OUT REAL:: Current cartesian velocity -**motion.digital-in-**_NN_ IN BIT:: +**motion.digital-in-**_NN_ IN BOOL:: These pins are used by M66 Pnn wait-for-input mode. -**motion.digital-out-**_NN_ OUT BIT:: +**motion.digital-out-**_NN_ OUT BOOL:: These pins are controlled by the M62 through M65 words. -*motion.distance-to-go* OUT FLOAT:: +*motion.distance-to-go* OUT REAL:: Distance remaining in the current move -*motion.enable* IN BIT:: +*motion.enable* IN BOOL:: If this bit is driven FALSE, motion stops, the machine is placed in the "machine off" state, and a message is displayed for the operator. For normal motion, drive this bit TRUE. -*motion.eoffset-active* OUT BIT:: +*motion.eoffset-active* OUT BOOL:: Indicates external offsets are active (non-zero) -*motion.eoffset-limited* OUT BIT:: +*motion.eoffset-limited* OUT BOOL:: Indicates motion with external offsets was limited by a soft limit constraint ([AXIS_L]MIN_LIMIT,MAX_LIMIT). -*motion.feed-hold* IN BIT:: +*motion.feed-hold* IN BOOL:: When Feed Stop Control is enabled with M53 P1, and this bit is TRUE, the feed rate is set to 0. Note: feed-hold applies to G-code commands -- not jogs. -*motion.feed-inhibit* IN BIT:: +*motion.feed-inhibit* IN BOOL:: When this pin is TRUE, machine motion is inhibited for G-code commands. If the machine is performing a spindle synchronized move when this pin @@ -161,7 +161,7 @@ Motion resumes when this pin goes FALSE. Note: feed-inhibit applies to G-code commands -- not jogs. -*motion.feed-upm* OUT FLOAT:: +*motion.feed-upm* OUT REAL:: Current feed rate in G-code program units per minute for motion.motion-type feed(2) and arc(3). Value is the G-code program F value multiplied by the current feed override value and the @@ -169,53 +169,53 @@ Note: feed-inhibit applies to G-code commands -- not jogs. motion.feed-hold or motion.feed-inhibit are asserted. If units (G20 or G21) are not specified in the G-code file then units will be the last units used. -*motion.feed-inches-per-minute* OUT FLOAT:: +*motion.feed-inches-per-minute* OUT REAL:: Current feed rate in inches per minute for motion.motion-type feed(2) and arc(3). Value is the inch equivalent of the G-code program F value multiplied by the current feed override value and the motion.adaptive-feed setting (if M52 active). Value is zero if motion.feed-hold or motion.feed-inhibit are asserted. -*motion.feed-inches-per-second* OUT FLOAT:: +*motion.feed-inches-per-second* OUT REAL:: Current feed rate in inches per second for motion.motion-type feed(2) and arc(3). Value is the inch equivalent of the G-code program F value multiplied by the current feed override value and the motion.adaptive-feed setting (if M52 active). Value is zero if motion.feed-hold or motion.feed-inhibit are asserted. -*motion.feed-mm-per-minute* OUT FLOAT:: +*motion.feed-mm-per-minute* OUT REAL:: Current feed rate in mm per minute for motion.motion-type feed(2) and arc(3). Value is the mm equivalent of the G-code program F value multiplied by the current feed override value and the motion.adaptive-feed setting (if M52 active). Value is zero if motion.feed-hold or motion.feed-inhibit are asserted. -*motion.feed-mm-per-second* OUT FLOAT:: +*motion.feed-mm-per-second* OUT REAL:: Current feed rate in mm per second for motion.motion-type feed(2) and arc(3). Value is the mm equivalent of the G-code program F value multiplied by the current feed override value and the motion.adaptive-feed setting (if M52 active). Value is zero if motion.feed-hold or motion.feed-inhibit are asserted. -*motion.homing-inhibit* IN BIT:: +*motion.homing-inhibit* IN BOOL:: If this bit is TRUE, initiation of any joint homing move (including "Home All") is disallowed and an error is reported. By default, homing is allowed in joint mode whenever motion is enabled. -*motion.is-all-homed* OUT BIT:: +*motion.is-all-homed* OUT BOOL:: TRUE if all active joints is homed. -*motion.jog-inhibit* IN BIT:: +*motion.jog-inhibit* IN BOOL:: If this bit is TRUE, jogging of any joint or axis is disallowed and an error is reported. -*motion.jog-stop* IN BIT:: +*motion.jog-stop* IN BOOL:: If any jog is active when the pin state changes to TRUE then that jog will be stopped following the associated acceleration values. -*motion.jog-stop-immediate* IN BIT:: +*motion.jog-stop-immediate* IN BOOL:: If any jog is active when the pin state changes to TRUE then that jog will be stopped immediately. -*motion.jog-is-active* OUT BIT:: +*motion.jog-is-active* OUT BOOL:: TRUE if any joint or axis is jogging. -*motion.in-position* OUT BIT:: +*motion.in-position* OUT BOOL:: TRUE if the machine is in position (i.e., not currently moving towards the commanded position). -**motion.misc-error-**_NN_ IN BIT:: +**motion.misc-error-**_NN_ IN BOOL:: Extra error inputs for faults such as over-temperature sensors, low coolant warnings, custom HAL component errors. If driven TRUE this will disable a machine. Similar to spindle.amp-fault-in. -*motion.motion-enabled* OUT BIT:: +*motion.motion-enabled* OUT BOOL:: + -*motion.motion-type* OUT S32:: +*motion.motion-type* OUT SINT:: These values are from src/emc/nml_intf/motion_types.h: 0: Idle (no motion) @@ -233,34 +233,34 @@ Note: feed-inhibit applies to G-code commands -- not jogs. 6: Rotary unlock for traverse -*motion.on-soft-limit* OUT BIT:: -*motion.probe-input* IN BIT:: +*motion.on-soft-limit* OUT BOOL:: +*motion.probe-input* IN BOOL:: G38.n uses the value on this pin to determine when the probe has made contact. TRUE for probe contact closed (touching), FALSE for probe contact open. -*motion.program-line* OUT S32:: +*motion.program-line* OUT SINT:: The current program line while executing. Zero if not running or between lines while single stepping. -*motion.requested-vel* OUT FLOAT:: +*motion.requested-vel* OUT REAL:: The current requested velocity in user units per second. This value is the F-word setting from the G-code file, possibly reduced to accommodate machine velocity and acceleration limits. The value on this pin does not reflect the feed override or any other adjustments. -*motion.servo.last-period* OUT U32:: +*motion.servo.last-period* OUT UINT:: Time (in ns) between invocations of the servo thread. Typically, this number divided by the CPU speed gives the time in seconds, and can be used to determine whether the realtime motion controller is meeting its timing constraints -*motion.switchkins-type* IN float:: +*motion.switchkins-type* IN REAL:: Kinematics modules that define the functions kinematicsSwitchable() and kinematicsSwitch() receive the *integer* value of this pin to select the machine kinematics functions. Extra G-code commands may be required to synchronize task and motion before and after changes to the pin value. -*motion.teleop-mode* OUT BIT:: +*motion.teleop-mode* OUT BOOL:: Motion mode is teleop (axis coordinate jogging available). -*motion.tooloffset.L* OUT FLOAT:: +*motion.tooloffset.L* OUT REAL:: Current tool offset for each axis where (*L* is the axis letter, one of: *x y z a b c u v w*) -*motion.tp-reverse* OUT BIT:: +*motion.tp-reverse* OUT BOOL:: Trajectory planning is reversed (reverse run) === Interpreter Metadata Pins @@ -269,10 +269,10 @@ These pins provide geometric intent and interpreter state for the segment of mot ==== Interpreter Status Pins -* `motion.interp.line-number` (s32, out) + +* `motion.interp.line-number` (sint, out) + The current G-code line number being executed. -* `motion.interp.motion-type` (s32, out) + +* `motion.interp.motion-type` (sint, out) + The type of motion currently in progress: ** 0: None ** 1: Rapid (G0) @@ -280,30 +280,30 @@ These pins provide geometric intent and interpreter state for the segment of mot ** 3: Arc (G2, G3) ** 4: Tool Change/Other -* `motion.interp.feedrate` (float, out) + +* `motion.interp.feedrate` (real, out) + The interpreted feedrate for the current segment in units per minute. ==== Interpreter Geometric Pins -* `motion.interp.heading` (float, out) + +* `motion.interp.heading` (real, out) + The XY plane heading of the current linear move in degrees. Measured counter-clockwise from the +X axis (0 to 360). This could be used to control a tangential knife. -* `motion.interp.arc-radius` (float, out) + +* `motion.interp.arc-radius` (real, out) + The radius of the current circular move. This value is 0.0 during linear moves. This could be used to modify plasma cutting parameters based on the arc radius and when hole cutting. -* `motion.interp.arc-center-x` (float, out) + +* `motion.interp.arc-center-x` (real, out) + The absolute X-coordinate of the center point for the current arc. 0 if in YZ plane -* `motion.interp.arc-center-y` (float, out) + +* `motion.interp.arc-center-y` (real, out) + The absolute Y-coordinate of the center point for the current arc. 0 if in XZ plane -* `motion.interp.arc-center-z` (float, out) + +* `motion.interp.arc-center-z` (real, out) + The absolute Y-coordinate of the center point for the current arc if in XZ or YZ plane. -* `motion.interp.normal-heading` (float, out) + +* `motion.interp.normal-heading` (real, out) + the heading from the current point back to the arc centre for the current arc. - * `motion.interp.iscircle` (bit, out) + + * `motion.interp.iscircle` (bool, out) + True if the current arc is a full circle and not a helix. [NOTE] @@ -313,52 +313,52 @@ These pins represent the *commanded geometric intent* from the interpreter and a (*L* is the axis letter, one of: *x y z a b c u v w*) -**axis.**_L_**.eoffset** OUT FLOAT:: +**axis.**_L_**.eoffset** OUT REAL:: Current external offset. -**axis.**_L_**.eoffset-clear** IN BIT:: +**axis.**_L_**.eoffset-clear** IN BOOL:: Clear external offset request -**axis.**_L_**.eoffset-counts** IN S32:: +**axis.**_L_**.eoffset-counts** IN SINT:: Counts input for external offset. The eoffset-counts are transferred to an internal register. The applied external offset is the product of the register counts and the eoffset-scale value. The register is *reset to zero at each machine startup*. If the machine is turned off with an external offset active, the eoffset-counts pin should be set to zero before restarting. -**axis.**_L_**.eoffset-enable** IN BIT:: +**axis.**_L_**.eoffset-enable** IN BOOL:: Enable for external offset (also requires INI file setting for [AXIS_L]OFFSET_AV_RATIO) -**axis.**_L_**.eoffset-request** OUT FLOAT:: +**axis.**_L_**.eoffset-request** OUT REAL:: Debug pin for requested external offset. -**axis.**_L_**.eoffset-scale** IN FLOAT:: +**axis.**_L_**.eoffset-scale** IN REAL:: Scale for external offset. -**axis.**_L_**.jog-accel-fraction** IN FLOAT:: +**axis.**_L_**.jog-accel-fraction** IN REAL:: Sets acceleration for wheel jogging to a fraction of the INI max_acceleration for the axis. Values greater than 1 or less than zero are ignored. -**axis.**_L_**.jog-counts** IN S32:: +**axis.**_L_**.jog-counts** IN SINT:: Connect to the "counts" pin of an external encoder to use a physical jog wheel. -**axis.**_L_**.jog-enable** IN BIT:: +**axis.**_L_**.jog-enable** IN BOOL:: When TRUE (and in manual mode), any change to "jog-counts" will result in motion. When false, "jog-counts" is ignored. -**axis.**_L_**.jog-scale** IN FLOAT:: +**axis.**_L_**.jog-scale** IN REAL:: Sets the distance moved for each count on "jog-counts", in machine units. -**axis.**_L_**.jog-vel-mode** IN BIT:: +**axis.**_L_**.jog-vel-mode** IN BOOL:: When FALSE (the default), the jogwheel operates in position mode. The axis will move exactly jog-scale units for each count, regardless of how long that might take. When TRUE, the wheel operates in velocity mode - motion stops when the wheel stops, even if that means the commanded motion is not completed. -**axis.**_L_**.kb-jog-active** OUT BIT:: +**axis.**_L_**.kb-jog-active** OUT BOOL:: (free planner axis jogging active (keyboard or halui)) -**axis.**_L_**.pos-cmd** OUT FLOAT:: +**axis.**_L_**.pos-cmd** OUT REAL:: The axis commanded position. There may be several offsets between the axis and motor coordinates: Backlash compensation, screw error compensation, and home offsets. External offsets are reported separately (axis._L_.eoffset). -**axis.**_L_**.teleop-pos-cmd** OUT FLOAT:: -**axis.**_L_**.teleop-tp-enable** OUT BIT:: +**axis.**_L_**.teleop-pos-cmd** OUT REAL:: +**axis.**_L_**.teleop-tp-enable** OUT BOOL:: TRUE when the "teleop planner" is enabled for this axis. -**axis.**_L_**.teleop-vel-cmd** OUT FLOAT:: +**axis.**_L_**.teleop-vel-cmd** OUT REAL:: The axis's commanded velocity. -**axis.**_L_**.teleop-vel-lim** OUT FLOAT:: +**axis.**_L_**.teleop-vel-lim** OUT REAL:: The velocity limit for the teleop planner. -**axis.**_L_**.wheel-jog-active** OUT BIT:: +**axis.**_L_**.wheel-jog-active** OUT BOOL:: + == JOINT PINS @@ -367,97 +367,97 @@ _N_ is the joint number (0 ... _num_joints_-1)) Note: Pins marked *(DEBUG)* serve as debugging aids and are subject to change or removal at any time. -**joint.**_N_**.acc-cmd** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.acc-cmd** OUT REAL *(DEBUG)*:: The joint's commanded acceleration. -**joint.**_N_**.active** OUT BIT *(DEBUG)*:: +**joint.**_N_**.active** OUT BOOL *(DEBUG)*:: TRUE when this joint is active. -**joint.**_N_**.amp-enable-out** OUT BIT:: +**joint.**_N_**.amp-enable-out** OUT BOOL:: TRUE if the amplifier for this joint should be enabled. -**joint.**_N_**.amp-fault-in** IN BIT:: +**joint.**_N_**.amp-fault-in** IN BOOL:: Should be driven TRUE if an external fault is detected with the amplifier for this joint. -**joint.**_N_**.backlash-corr** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.backlash-corr** OUT REAL *(DEBUG)*:: Backlash or screw compensation raw value. -**joint.**_N_**.backlash-filt** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.backlash-filt** OUT REAL *(DEBUG)*:: Backlash or screw compensation filtered value (respecting motion limits). -**joint.**_N_**.backlash-vel** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.backlash-vel** OUT REAL *(DEBUG)*:: Backlash or screw compensation velocity. -**joint.**_N_**.coarse-pos-cmd** OUT FLOAT *(DEBUG)*:: -**joint.**_N_**.error** OUT BIT *(DEBUG)*:: +**joint.**_N_**.coarse-pos-cmd** OUT REAL *(DEBUG)*:: +**joint.**_N_**.error** OUT BOOL *(DEBUG)*:: TRUE when t*his joint has encountered an error, such as a limit switch closing. -**joint.**_N_**.f-error** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.f-error** OUT REAL *(DEBUG)*:: The actual following error. -**joint.**_N_**.f-error-lim** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.f-error-lim** OUT REAL *(DEBUG)*:: The following error limit. -**joint.**_N_**.f-errored** OUT BIT *(DEBUG)*:: +**joint.**_N_**.f-errored** OUT BOOL *(DEBUG)*:: TRUE when this joint has exceeded the following error limit. -**joint.**_N_**.faulted** OUT BIT *(DEBUG)*:: -**joint.**_N_**.free-pos-cmd** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.faulted** OUT BOOL *(DEBUG)*:: +**joint.**_N_**.free-pos-cmd** OUT REAL *(DEBUG)*:: The "free planner" commanded position for this joint. -**joint.**_N_**.free-tp-enable** OUT BIT *(DEBUG)*:: +**joint.**_N_**.free-tp-enable** OUT BOOL *(DEBUG)*:: TRUE when the "free planner" is enabled for this joint. -**joint.**_N_**.free-vel-lim** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.free-vel-lim** OUT REAL *(DEBUG)*:: The velocity limit for the free planner. -**joint.**_N_**.home-state** OUT S32 *(DEBUG)*:: +**joint.**_N_**.home-state** OUT SINT *(DEBUG)*:: homing state machine state -**joint.**_N_**.home-sw-in** IN BIT:: +**joint.**_N_**.home-sw-in** IN BOOL:: Should be driven TRUE if the home switch for this joint is closed. -**joint.**_N_**.homed** OUT BIT *(DEBUG)*:: +**joint.**_N_**.homed** OUT BOOL *(DEBUG)*:: TRUE if the joint has been homed. -**joint.**_N_**.homing** OUT BIT:: +**joint.**_N_**.homing** OUT BOOL:: TRUE if the joint is currently homing. -**joint.**_N_**.in-position** OUT BIT *(DEBUG)*:: +**joint.**_N_**.in-position** OUT BOOL *(DEBUG)*:: TRUE if the joint is using the "free planner" and has come to a stop. **joint.**_N_**.index-enable** IO BIT:: Should be attached to the index-enable pin of the joint's encoder to enable homing to index pulse. -**joint.**_N_**.is-unlocked** IN BIT:: +**joint.**_N_**.is-unlocked** IN BOOL:: Indicates joint is unlocked (see JOINT UNLOCK PINS). -**joint.**_N_**.jog-accel-fraction** IN FLOAT:: +**joint.**_N_**.jog-accel-fraction** IN REAL:: Sets acceleration for wheel jogging to a fraction of the INI max_acceleration for the joint. Values greater than 1 or less than zero are ignored. -**joint.**_N_**.jog-counts** IN S32:: +**joint.**_N_**.jog-counts** IN SINT:: Connect to the "counts" pin of an external encoder to use a physical jog wheel. -**joint.**_N_**.jog-enable** IN BIT:: +**joint.**_N_**.jog-enable** IN BOOL:: When TRUE (and in manual mode), any change to "jog-counts" will result in motion. When false, "jog-counts" is ignored. -**joint.**_N_**.jog-scale** IN FLOAT:: +**joint.**_N_**.jog-scale** IN REAL:: Sets the distance moved for each count on "jog-counts", in machine units. -**joint.**_N_**.jog-vel-mode** IN BIT:: +**joint.**_N_**.jog-vel-mode** IN BOOL:: When FALSE (the default), the jogwheel operates in position mode. The joint will move exactly jog-scale units for each count, regardless of how long that might take. When TRUE, the wheel operates in velocity mode - motion stops when the wheel stops, even if that means the commanded motion is not completed. -**joint.**_N_**.kb-jog-active** OUT BIT *(DEBUG)*:: +**joint.**_N_**.kb-jog-active** OUT BOOL *(DEBUG)*:: (free planner joint jogging active (keyboard or halui)) -**joint.**_N_**.motor-offset** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.motor-offset** OUT REAL *(DEBUG)*:: joint motor offset established when joint is homed. -**joint.**_N_**.motor-pos-cmd** OUT FLOAT:: +**joint.**_N_**.motor-pos-cmd** OUT REAL:: The commanded position for this joint. -**joint.**_N_**.motor-pos-fb** IN FLOAT:: +**joint.**_N_**.motor-pos-fb** IN REAL:: The actual position for this joint. -**joint.**_N_**.neg-hard-limit** OUT BIT *(DEBUG)*:: +**joint.**_N_**.neg-hard-limit** OUT BOOL *(DEBUG)*:: The negative hard limit for the joint -**joint.**_N_**.neg-lim-sw-in** IN BIT:: +**joint.**_N_**.neg-lim-sw-in** IN BOOL:: Should be driven TRUE if the negative limit switch for this joint is tripped. -**joint.**_N_**.pos-cmd** OUT FLOAT:: +**joint.**_N_**.pos-cmd** OUT REAL:: The joint (as opposed to motor) commanded position. There may be several offsets between the joint and motor coordinates: backlash compensation, screw error compensation, and home offsets. -**joint.**_N_**.pos-fb** OUT FLOAT:: +**joint.**_N_**.pos-fb** OUT REAL:: The joint feedback position. This value is computed from the actual motor position minus joint offsets. Useful for machine visualization. -**joint.**_N_**.pos-hard-limit** OUT BIT *(DEBUG)*:: +**joint.**_N_**.pos-hard-limit** OUT BOOL *(DEBUG)*:: The positive hard limit for the joint. -**joint.**_N_**.pos-lim-sw-in** IN BIT:: +**joint.**_N_**.pos-lim-sw-in** IN BOOL:: Should be driven TRUE if the positive limit switch for this joint is tripped. -**joint.**_N_**.unlock** OUT BIT:: +**joint.**_N_**.unlock** OUT BOOL:: TRUE if the axis is a locked joint (typically a rotary) and a move is commanded (see JOINT UNLOCK PINS). -**joint.**_N_**.vel-cmd** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.vel-cmd** OUT REAL *(DEBUG)*:: The joint's commanded velocity. -**joint.**_N_**.jerk-cmd** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.jerk-cmd** OUT REAL *(DEBUG)*:: The joint's commanded jerk (rate of change of acceleration). Only active when S-curve trajectory planning is enabled (INI file [TRAJ]PLANNER_TYPE=1 and [TRAJ]MAX_LINEAR_JERK>0). Jerk limits are set via INI file [JOINT_N]MAX_JERK or via the ini.N.max_jerk HAL pin. -**joint.**_N_**.wheel-jog-active** OUT BIT *(DEBUG)*:: +**joint.**_N_**.wheel-jog-active** OUT BOOL *(DEBUG)*:: + == JOINT posthome pins @@ -480,63 +480,63 @@ Example: loadrt motmod ... **unlock_joints_mask=**0x38 creates unlock pins for j (_M_ is the spindle number (*0* ... *num_spindles-1*)) -**spindle.**_M_**.amp-fault-in** IN BIT:: +**spindle.**_M_**.amp-fault-in** IN BOOL:: Should be driven TRUE if an external fault is detected with the amplifier for this spindle. -**spindle.**_M_**.at-speed** IN BIT:: +**spindle.**_M_**.at-speed** IN BOOL:: Motion will pause until this pin is TRUE, under the following conditions: Before the first feed move after each spindle start or speed change; before the start of every chain of spindle-synchronized moves; and if in CSS mode, at every rapid->feed transition. -**spindle.**_M_**.brake** OUT BIT:: +**spindle.**_M_**.brake** OUT BOOL:: TRUE when the spindle brake should be applied. -**spindle.**_M_**.forward** OUT BIT:: +**spindle.**_M_**.forward** OUT BOOL:: TRUE when the spindle should rotate forward. **spindle.**_M_**.index-enable** I/O BIT:: For correct operation of spindle synchronized moves, this signal must be hooked to the index-enable pin of the spindle encoder. -**spindle.**_M_**.inhibit** IN BIT:: +**spindle.**_M_**.inhibit** IN BOOL:: When TRUE, the spindle speed is set and held to 0. -**spindle.**_M_**.is-oriented** IN BIT:: +**spindle.**_M_**.is-oriented** IN BOOL:: Acknowledge pin for spindle-orient. Completes orient cycle. If spindle-orient was true when spindle-is-oriented was asserted, the spindle-orient pin is cleared and the spindle-locked pin is asserted. Also, the spindle-brake pin is asserted. -**spindle.**_M_**.locked** OUT BIT:: +**spindle.**_M_**.locked** OUT BOOL:: Spindle orient complete pin. Cleared by any of M3, M4 or M5. -**spindle.**_M_**.on** OUT BIT:: +**spindle.**_M_**.on** OUT BOOL:: TRUE when spindle should rotate. -**spindle.**_M_**.orient** OUT BIT:: +**spindle.**_M_**.orient** OUT BOOL:: Indicates start of spindle orient cycle. Set by M19. Cleared by any of M3, M4 or M5. If spindle-orient-fault is not zero during spindle-orient true, the M19 command fails with an error message. -**spindle.**_M_**.orient-angle** OUT FLOAT:: +**spindle.**_M_**.orient-angle** OUT REAL:: Desired spindle orientation for M19. Value of the M19 R word parameter plus the value of the [RS274NGC]ORIENT_OFFSET INI parameter. -**spindle.**_M_**.orient-fault** IN S32:: +**spindle.**_M_**.orient-fault** IN SINT:: Fault code input for orient cycle. Any value other than zero will cause the orient cycle to abort. -**spindle.**_M_**.orient-mode** OUT BIT:: +**spindle.**_M_**.orient-mode** OUT BOOL:: Desired spindle rotation mode. Reflects M19 P parameter word. -**spindle.**_M_**.reverse** OUT BIT:: +**spindle.**_M_**.reverse** OUT BOOL:: TRUE when the spindle should rotate backward. -**spindle.**_M_**.revs** IN FLOAT:: +**spindle.**_M_**.revs** IN REAL:: For correct operation of spindle synchronized moves, this signal must be hooked to the position pin of the spindle encoder. **spindle.**_M_**.speed-cmd-rps** FLOAT OUT:: Commanded spindle speed in units of revolutions per second. -**spindle.**_M_**.speed-in** IN FLOAT:: +**spindle.**_M_**.speed-in** IN REAL:: Actual spindle speed feedback in revolutions per second; used for G96 (constant surface speed) and G95 (feed per revolution) modes. -**spindle.**_M_**.speed-out** OUT FLOAT:: +**spindle.**_M_**.speed-out** OUT REAL:: Desired spindle speed in rotations per minute. -**spindle.**_M_**.speed-out-abs** OUT FLOAT:: +**spindle.**_M_**.speed-out-abs** OUT REAL:: Desired spindle speed in rotations per minute, always positive regardless of spindle direction. -**spindle.**_M_**.speed-out-rps** OUT FLOAT:: +**spindle.**_M_**.speed-out-rps** OUT REAL:: Desired spindle speed in rotations per second. -**spindle.**_M_**.speed-out-rps-abs** OUT FLOAT:: +**spindle.**_M_**.speed-out-rps-abs** OUT REAL:: Desired spindle speed in rotations per second, always positive regardless of spindle direction. == MOTION PARAMETERS diff --git a/docs/src/man/man9/weighted_sum.9.adoc b/docs/src/man/man9/weighted_sum.9.adoc index dfd1593cad8..d2dcec09008 100644 --- a/docs/src/man/man9/weighted_sum.9.adoc +++ b/docs/src/man/man9/weighted_sum.9.adoc @@ -45,4 +45,4 @@ There is a limit of 8 weighted summers and each may have up to 16 input bits. == SEE ALSO -scaled_s32_sums(9), sum2(9) +scaled_sint_sums(9), sum2(9) diff --git a/lib/python/gladevcp/builtin-panels/gtk_little_probe/gtk_little_probe.py b/lib/python/gladevcp/builtin-panels/gtk_little_probe/gtk_little_probe.py index 918d63a08b2..7f790cf2d7b 100644 --- a/lib/python/gladevcp/builtin-panels/gtk_little_probe/gtk_little_probe.py +++ b/lib/python/gladevcp/builtin-panels/gtk_little_probe/gtk_little_probe.py @@ -149,27 +149,27 @@ def __init__(self, halcomp,builder,useropts): self.halcomp = hal.component("probe") - self.halcomp.newpin( "ps_searchvel", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_probevel", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_z_clearance", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_probe_max", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_probe_latch", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_probe_diam", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_xy_clearance", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_edge_lenght", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_offs_x", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_offs_y", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_offs_z", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_offs_angle", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "set_zero", hal.HAL_BIT, hal.HAL_OUT ) + self.halcomp.newpin( "ps_searchvel", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_probevel", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_z_clearance", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_probe_max", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_probe_latch", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_probe_diam", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_xy_clearance", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_edge_lenght", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_offs_x", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_offs_y", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_offs_z", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_offs_angle", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "set_zero", hal.Type.BOOL, hal.Dir.OUT ) if self.chk_set_zero.get_active(): self.halcomp["set_zero"] = True self.hal_led_set_zero.hal_pin.set(1) - self.halcomp.newpin( "auto_rott", hal.HAL_BIT, hal.HAL_OUT ) + self.halcomp.newpin( "auto_rott", hal.Type.BOOL, hal.Dir.OUT ) if self.chk_auto_rott.get_active(): self.halcomp["auto_rott"] = True self.hal_led_auto_rott.hal_pin.set(1) - self.halcomp.newpin( "ps_error", hal.HAL_FLOAT, hal.HAL_OUT ) + self.halcomp.newpin( "ps_error", hal.Type.REAL, hal.Dir.OUT ) self.spbtn1_search_vel.set_value( self.prefs.getpref( "ps_searchvel", 300.0, float ) ) self.spbtn1_probe_vel.set_value( self.prefs.getpref( "ps_probevel", 10.0, float ) ) self.spbtn1_z_clearance.set_value( self.prefs.getpref( "ps_z_clearance", 3.0, float ) ) diff --git a/lib/python/gladevcp/builtin-panels/gtk_verser_probe/gtk_verser_probe.py b/lib/python/gladevcp/builtin-panels/gtk_verser_probe/gtk_verser_probe.py index ff3bfdf9700..b538e0b26d2 100644 --- a/lib/python/gladevcp/builtin-panels/gtk_verser_probe/gtk_verser_probe.py +++ b/lib/python/gladevcp/builtin-panels/gtk_verser_probe/gtk_verser_probe.py @@ -151,27 +151,27 @@ def __init__(self, halcomp,builder,useropts): self.halcomp = hal.component("probe") - self.halcomp.newpin( "ps_searchvel", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_probevel", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_z_clearance", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_probe_max", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_probe_latch", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_probe_diam", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_xy_clearance", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_edge_lenght", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_offs_x", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_offs_y", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_offs_z", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "ps_offs_angle", hal.HAL_FLOAT, hal.HAL_OUT ) - self.halcomp.newpin( "set_zero", hal.HAL_BIT, hal.HAL_OUT ) + self.halcomp.newpin( "ps_searchvel", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_probevel", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_z_clearance", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_probe_max", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_probe_latch", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_probe_diam", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_xy_clearance", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_edge_lenght", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_offs_x", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_offs_y", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_offs_z", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "ps_offs_angle", hal.Type.REAL, hal.Dir.OUT ) + self.halcomp.newpin( "set_zero", hal.Type.BOOL, hal.Dir.OUT ) if self.chk_set_zero.get_active(): self.halcomp["set_zero"] = True self.hal_led_set_zero.hal_pin.set(1) - self.halcomp.newpin( "auto_rott", hal.HAL_BIT, hal.HAL_OUT ) + self.halcomp.newpin( "auto_rott", hal.Type.BOOL, hal.Dir.OUT ) if self.chk_auto_rott.get_active(): self.halcomp["auto_rott"] = True self.hal_led_auto_rott.hal_pin.set(1) - self.halcomp.newpin( "ps_error", hal.HAL_FLOAT, hal.HAL_OUT ) + self.halcomp.newpin( "ps_error", hal.Type.REAL, hal.Dir.OUT ) self.spbtn1_search_vel.set_value( self.prefs.getpref( "ps_searchvel", 300.0, float ) ) self.spbtn1_probe_vel.set_value( self.prefs.getpref( "ps_probevel", 10.0, float ) ) self.spbtn1_z_clearance.set_value( self.prefs.getpref( "ps_z_clearance", 3.0, float ) ) diff --git a/lib/python/gladevcp/core.py b/lib/python/gladevcp/core.py index fd34bda79c4..260112051a0 100644 --- a/lib/python/gladevcp/core.py +++ b/lib/python/gladevcp/core.py @@ -5,7 +5,6 @@ from gi.repository import GObject import inspect -import _hal import hal import traceback diff --git a/lib/python/gladevcp/hal_bar.py b/lib/python/gladevcp/hal_bar.py index db83c789f15..2040e4efc89 100644 --- a/lib/python/gladevcp/hal_bar.py +++ b/lib/python/gladevcp/hal_bar.py @@ -221,7 +221,7 @@ def get_value_diff(self, value): def _hal_init(self): _HalWidgetBase._hal_init(self) - self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_FLOAT, hal.HAL_IN) + self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.REAL, hal.Dir.IN) self.hal_pin.connect('value-changed', lambda p: self.set_value(p.value)) self.hal_pin.connect('value-changed', lambda s: self.emit('hal-pin-changed', s)) diff --git a/lib/python/gladevcp/hal_graph.py b/lib/python/gladevcp/hal_graph.py index 70eab5f2812..661f4afacc4 100644 --- a/lib/python/gladevcp/hal_graph.py +++ b/lib/python/gladevcp/hal_graph.py @@ -111,7 +111,7 @@ def __init__(self): def _hal_init(self): _HalWidgetBase._hal_init(self) - self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_FLOAT, hal.HAL_IN) + self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.REAL, hal.Dir.IN) def tick_poll(self, idx): if self.tick_idx != idx: diff --git a/lib/python/gladevcp/hal_lightbutton.py b/lib/python/gladevcp/hal_lightbutton.py index b83ddff4087..f9ede93e68d 100644 --- a/lib/python/gladevcp/hal_lightbutton.py +++ b/lib/python/gladevcp/hal_lightbutton.py @@ -375,16 +375,16 @@ def _hal_init(self): self.set_active(False) if (self.button_halio_pin): - self.button_pin = self.hal.newpin(self.hal_name+'-button', hal.HAL_BIT, hal.HAL_IO) + self.button_pin = self.hal.newpin(self.hal_name+'-button', hal.Type.BOOL, hal.Dir.IO) self.button_pin.connect('value-changed', self.button_pin_update) else: - self.button_pin = self.hal.newpin(self.hal_name+'-button', hal.HAL_BIT, hal.HAL_OUT) - self.button_pin_not = self.hal.newpin(self.hal_name+'-button-not', hal.HAL_BIT, hal.HAL_OUT) + self.button_pin = self.hal.newpin(self.hal_name+'-button', hal.Type.BOOL, hal.Dir.OUT) + self.button_pin_not = self.hal.newpin(self.hal_name+'-button-not', hal.Type.BOOL, hal.Dir.OUT) if (self.create_enable_pin): - self.enable_pin = self.hal.newpin(self.hal_name+'-enable', hal.HAL_BIT, hal.HAL_IN) + self.enable_pin = self.hal.newpin(self.hal_name+'-enable', hal.Type.BOOL, hal.Dir.IN) self.enable_pin.connect('value-changed', self.enable_pin_update) - self.light_pin = self.hal.newpin(self.hal_name+'-light', hal.HAL_BIT, hal.HAL_IN) + self.light_pin = self.hal.newpin(self.hal_name+'-light', hal.Type.BOOL, hal.Dir.IN) self.light_pin.connect('value-changed', self.light_pin_update) def button_pin_update(self, hal_pin, data=None): diff --git a/lib/python/gladevcp/hal_meter.py b/lib/python/gladevcp/hal_meter.py index 017743fc163..8744058a6c6 100644 --- a/lib/python/gladevcp/hal_meter.py +++ b/lib/python/gladevcp/hal_meter.py @@ -87,7 +87,7 @@ def __init__(self): def _hal_init(self): _HalWidgetBase._hal_init(self) - self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_FLOAT, hal.HAL_IN) + self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.REAL, hal.Dir.IN) self.hal_pin.connect('value-changed', lambda p: self.set_value(p.value)) self.hal_pin.connect('value-changed', lambda s: self.emit('hal-pin-changed', s)) diff --git a/lib/python/gladevcp/hal_widgets.py b/lib/python/gladevcp/hal_widgets.py index fa33745f03c..ddb18f0a9e9 100644 --- a/lib/python/gladevcp/hal_widgets.py +++ b/lib/python/gladevcp/hal_widgets.py @@ -41,8 +41,8 @@ def hal_update(self): class _HalToggleBase(_HalWidgetBase): def _hal_init(self): self.set_active(False) - self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_BIT, hal.HAL_OUT) - self.hal_pin_not = self.hal.newpin(self.hal_name + "-not", hal.HAL_BIT, hal.HAL_OUT) + self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.BOOL, hal.Dir.OUT) + self.hal_pin_not = self.hal.newpin(self.hal_name + "-not", hal.Type.BOOL, hal.Dir.OUT) self.connect("toggled", self.hal_update) def hal_update(self, *a): @@ -52,8 +52,8 @@ def hal_update(self, *a): class _HalScaleBase(_HalWidgetBase): def _hal_init(self): - self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_FLOAT, hal.HAL_OUT) - self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.HAL_S32, hal.HAL_OUT) + self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.REAL, hal.Dir.OUT) + self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.Type.SINT, hal.Dir.OUT) self.connect("value-changed", self.hal_update) def hal_update(self, *a): @@ -62,7 +62,7 @@ def hal_update(self, *a): class _HalIOScaleBase(_HalWidgetBase): def _hal_init(self): - self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_FLOAT, hal.HAL_IO) + self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.REAL, hal.Dir.IO) self.connect("value-changed", self.hal_update) self.hal_pin.connect('value-changed', lambda s: self.emit('hal-pin-changed', s)) self.hal_current = self.hal_pin.get() @@ -80,21 +80,21 @@ def hal_update(self, *a): class _HalSensitiveBase(_HalWidgetBase): def _hal_init(self): - self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_BIT, hal.HAL_IN) + self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.BOOL, hal.Dir.IN) self.hal_pin.connect('value-changed', lambda s: self.set_sensitive(s.value)) self.hal_pin.connect('value-changed', lambda s: self.emit('hal-pin-changed', s)) class _HalJogWheelBase(_HalWidgetBase): def _hal_init(self): - self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_S32, hal.HAL_OUT) + self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.SINT, hal.Dir.OUT) try: self.get_scaled_value() - self.hal_pin_scaled = self.hal.newpin(self.hal_name+'-scaled', hal.HAL_FLOAT, hal.HAL_OUT) + self.hal_pin_scaled = self.hal.newpin(self.hal_name+'-scaled', hal.Type.REAL, hal.Dir.OUT) except: pass try: self.get_delta_scaled_value() - self.hal_pin_delta_scaled = self.hal.newpin(self.hal_name+'-delta-scaled', hal.HAL_FLOAT, hal.HAL_OUT) + self.hal_pin_delta_scaled = self.hal.newpin(self.hal_name+'-delta-scaled', hal.Type.REAL, hal.Dir.OUT) except: pass @@ -114,7 +114,7 @@ def hal_update(self, *a): class _HalSpeedControlBase(_HalWidgetBase): def _hal_init(self): - self.hal_pin = self.hal.newpin(self.hal_name + '.value', hal.HAL_FLOAT, hal.HAL_OUT) + self.hal_pin = self.hal.newpin(self.hal_name + '.value', hal.Type.REAL, hal.Dir.OUT) self.connect("value-changed", self.hal_update) def hal_update(self, *a): @@ -134,7 +134,7 @@ class HAL_HideTable(Gtk.Grid, _HalWidgetBase): __gsignals__ = dict([hal_pin_changed_signal]) def _hal_init(self): - self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_BIT, hal.HAL_IN) + self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.BOOL, hal.Dir.IN) self.hal_pin.connect('value-changed',self.update) def update(self,*a): @@ -166,8 +166,8 @@ def do_set_property(self, property, value): raise AttributeError('unknown property %s' % property.name) def _hal_init(self): - self.hal_pin_f = self.hal.newpin(self.hal_name+"-f", hal.HAL_FLOAT, hal.HAL_OUT) - self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.HAL_S32, hal.HAL_OUT) + self.hal_pin_f = self.hal.newpin(self.hal_name+"-f", hal.Type.REAL, hal.Dir.OUT) + self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.Type.SINT, hal.Dir.OUT) self.connect("changed", self.hal_update) def hal_update(self, *a): @@ -184,7 +184,7 @@ class HAL_Button(Gtk.Button, _HalWidgetBase): __gtype_name__ = "HAL_Button" def _hal_init(self): - self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_BIT, hal.HAL_OUT) + self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.BOOL, hal.Dir.OUT) def _f(w, data): self.hal_pin.set(data) self.connect("pressed", _f, True) @@ -196,7 +196,7 @@ class HALIO_Button(Gtk.ToggleButton, _HalWidgetBase): def _hal_init(self): self.set_active(False) - self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_BIT, hal.HAL_IO) + self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.BOOL, hal.Dir.IO) def _f(w, data): self.set_active(True) self.hal_pin.set(data) @@ -219,8 +219,8 @@ def hal_update(self, *a): self.hal_pin_s.set(int(data)) def _hal_init(self): - self.hal_pin_f = self.hal.newpin(self.hal_name+"-f", hal.HAL_FLOAT, hal.HAL_OUT) - self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.HAL_S32, hal.HAL_OUT) + self.hal_pin_f = self.hal.newpin(self.hal_name+"-f", hal.Type.REAL, hal.Dir.OUT) + self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.Type.SINT, hal.Dir.OUT) self.connect("value-changed", self.hal_update) self.emit("value-changed") @@ -278,8 +278,8 @@ def do_set_property(self, property, value): raise AttributeError('unknown property %s' % property.name) def _hal_init(self): - self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_FLOAT, hal.HAL_IN) - self.hal_pin_scale = self.hal.newpin(self.hal_name+".scale", hal.HAL_FLOAT, hal.HAL_IN) + self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.REAL, hal.Dir.IN) + self.hal_pin_scale = self.hal.newpin(self.hal_name+".scale", hal.Type.REAL, hal.Dir.IN) if self.yellow_limit or self.red_limit: self.set_fraction(0) self.modify_bg(Gtk.STATE_PRELIGHT, Gdk.Color.parse('#0f0')[1]) @@ -349,14 +349,14 @@ def do_set_property(self, property, value): def _hal_init(self): - types = {0:hal.HAL_S32 - ,1:hal.HAL_FLOAT - ,2:hal.HAL_U32 + types = {0:hal.Type.SINT + ,1:hal.Type.REAL + ,2:hal.Type.UINT } pin_type = types.get(self.label_pin_type, None) if pin_type is None: raise TypeError("%s: Invalid pin type: %s" % (self.hal_name, self.label_pin_type)) - self.hal_pin = self.hal.newpin(self.hal_name, pin_type, hal.HAL_IN) + self.hal_pin = self.hal.newpin(self.hal_name, pin_type, hal.Dir.IN) self.hal_pin.connect('value-changed', lambda p: self.set_text(self.text_template % p.value)) self.hal_pin.connect('value-changed', lambda s: self.emit('hal-pin-changed', s)) diff --git a/lib/python/gladevcp/jogwheel.py b/lib/python/gladevcp/jogwheel.py index 1b762226bb3..e1ccebc5679 100644 --- a/lib/python/gladevcp/jogwheel.py +++ b/lib/python/gladevcp/jogwheel.py @@ -96,7 +96,7 @@ def __init__(self, size = 200, cpr = 40): # init the hal pin management def _hal_init(self): _HalJogWheelBase._hal_init(self) - self.hal_pin_scale = self.hal.newpin(self.hal_name+".scale", hal.HAL_FLOAT, hal.HAL_IN) + self.hal_pin_scale = self.hal.newpin(self.hal_name+".scale", hal.Type.REAL, hal.Dir.IN) self.hal_pin_scale.set(1.0) # This function is called from hal_widgets.py diff --git a/lib/python/gladevcp/speedcontrol.py b/lib/python/gladevcp/speedcontrol.py index 332f025ab0d..61db15711db 100755 --- a/lib/python/gladevcp/speedcontrol.py +++ b/lib/python/gladevcp/speedcontrol.py @@ -162,17 +162,17 @@ def _update_widget(self): def _hal_init(self): _HalSpeedControlBase._hal_init(self) # the scale, as the widget may show units per minute, but linuxcnc expects units per second - self.hal_pin_scale = self.hal.newpin(self.hal_name+".scale", hal.HAL_FLOAT, hal.HAL_IN) + self.hal_pin_scale = self.hal.newpin(self.hal_name+".scale", hal.Type.REAL, hal.Dir.IN) self.hal_pin_scale.connect("value-changed", self._on_scale_changed) self.hal_pin_scale.set(60.0) # the scaled value to be handled in hal - self.hal_pin_scaled_value = self.hal.newpin(self.hal_name+".scaled-value", hal.HAL_FLOAT, hal.HAL_OUT) + self.hal_pin_scaled_value = self.hal.newpin(self.hal_name+".scaled-value", hal.Type.REAL, hal.Dir.OUT) # pins to allow hardware button to be connected to the software button - self.hal_pin_increase = self.hal.newpin(self.hal_name+".increase", hal.HAL_BIT, hal.HAL_IN) + self.hal_pin_increase = self.hal.newpin(self.hal_name+".increase", hal.Type.BOOL, hal.Dir.IN) self.hal_pin_increase.connect("value-changed", self._on_plus_changed) - self.hal_pin_decrease = self.hal.newpin(self.hal_name+".decrease", hal.HAL_BIT, hal.HAL_IN) + self.hal_pin_decrease = self.hal.newpin(self.hal_name+".decrease", hal.Type.BOOL, hal.Dir.IN) self.hal_pin_decrease.connect("value-changed", self._on_minus_changed) # this draws our widget on the screen diff --git a/lib/python/hal.py b/lib/python/hal.py index 68fa796eebc..0fa81b63991 100644 --- a/lib/python/hal.py +++ b/lib/python/hal.py @@ -11,8 +11,8 @@ import hal, time h = hal.component("component-name") # create pins and parameters with calls to h.newpin and h.newparam -h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("out", hal.HAL_FLOAT, hal.HAL_OUT) +h.newpin("in", hal.Type.REAL, hal.Dir.IN) +h.newpin("out", hal.Type.REAL, hal.Dir.OUT) h.ready() # mark the component as 'ready' try: @@ -48,6 +48,22 @@ def __getattr__(name): warnings.warn(f"{name} is deprecated, use lcnc_realtime.verify() instead", FutureWarning, stacklevel=2) return not lcnc_realtime.verify() + oldnames = { + 'HAL_BIT' : (_hal.Type.BOOL, 'BOOL'), + 'HAL_FLOAT': (_hal.Type.REAL, 'REAL'), + 'HAL_S32' : (_hal.Type.SINT, 'SINT'), + 'HAL_U32' : (_hal.Type.UINT, 'UINT'), + 'HAL_S64' : (_hal.Type.SINT, 'SINT'), + 'HAL_U64' : (_hal.Type.UINT, 'UINT') + } + if name in oldnames: + nt, nn = oldnames[name] + if name in ('HAL_S32', 'HAL_U32'): + warnings.warn(f"{name} is no longer supported and replaced by hal.Type.{nn}", FutureWarning, stacklevel=2) + else: + warnings.warn(f"{name} has been deprecated. Please use the IntEnum type hal.Type.{nn}", FutureWarning, stacklevel=2) + return nt + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") class _ItemWrap(object): diff --git a/lib/python/pyvcp_widgets.py b/lib/python/pyvcp_widgets.py index 46dba0388bb..bc618ddb4b4 100644 --- a/lib/python/pyvcp_widgets.py +++ b/lib/python/pyvcp_widgets.py @@ -59,7 +59,7 @@ class pyvcp_dial(Canvas): # Dial widget by tomp - """ A dial that outputs a HAL_FLOAT + """ A dial that outputs a HAL_REAL reacts to both mouse-wheel and mouse dragging [ 376 ] @@ -202,11 +202,11 @@ def __init__(self,root,pycomp,halpin=None,halparam=None,param_pin=0,size=200,cpr if halparam == None: halparam = "dial." + str(pyvcp_dial.n) + ".param_pin" self.halparam=halparam - pycomp.newpin(halparam, HAL_FLOAT, HAL_IN) + pycomp.newpin(halparam, Type.REAL, Dir.IN) pyvcp_dial.n += 1 self.pycomp=pycomp - pycomp.newpin(halpin, HAL_FLOAT, HAL_OUT) + pycomp.newpin(halpin, Type.REAL, Dir.OUT) pycomp[self.halparam] = self.origValue self.oldValue = self.origValue @@ -402,7 +402,7 @@ def __init__(self,root,pycomp,halpin=None, size=200,text=None,subtext=None,min_= if halpin == None: self.halpin = "meter."+str(pyvcp_meter.n)+".value" pyvcp_meter.n += 1 - pycomp.newpin(self.halpin, HAL_FLOAT, HAL_IN) + pycomp.newpin(self.halpin, Type.REAL, Dir.IN) self.value = pycomp[self.halpin] def rad2deg(self, rad): return rad*180/math.pi @@ -464,7 +464,7 @@ def draw_ticks(self): # ------------------------------------------- class pyvcp_jogwheel(Canvas): - """" A jogwheel that outputs a HAL_FLOAT count + """" A jogwheel that outputs a HAL_REAL count reacts to both mouse-wheel and mouse dragging [ 33 ] (counts per revolution) @@ -550,7 +550,7 @@ def __init__(self,root,pycomp,halpin=None,text=None,clear_pin=0,scale_pin=0, halpin = "jogwheel."+str(pyvcp_jogwheel.n) + name pyvcp_jogwheel.n += 1 self.halpin=halpin - pycomp.newpin(halpin, HAL_FLOAT, HAL_OUT) + pycomp.newpin(halpin, Type.REAL, Dir.OUT) pycomp[self.halpin] = self.count self.pycomp=pycomp @@ -561,13 +561,13 @@ def __init__(self,root,pycomp,halpin=None,text=None,clear_pin=0,scale_pin=0, name = ".reset" clear_pin = halpin + name self.clear_pin = clear_pin - pycomp.newpin(clear_pin, HAL_BIT, HAL_IN) + pycomp.newpin(clear_pin, Type.BOOL, Dir.IN) if scale_pin!=0: name = ".scale" scale_pin = halpin + name self.scale_pin = scale_pin - pycomp.newpin(scale_pin, HAL_FLOAT, HAL_IN) + pycomp.newpin(scale_pin, Type.REAL, Dir.IN) def update_jogscale(self): if self.scale_pin: @@ -694,7 +694,7 @@ def __init__(self,master,pycomp,halpin=None,initval=0,orient=None,choices=[],**k if n==initval: b.select() c_halpin=halpin+"."+str(c) - pycomp.newpin(c_halpin, HAL_BIT, HAL_OUT) + pycomp.newpin(c_halpin, Type.BOOL, Dir.OUT) self.halpins.append(c_halpin) n+=1 @@ -743,7 +743,7 @@ def __init__(self,master,pycomp,halpin=None,disable_pin=False,**kw): pyvcp_label.n += 1 halpin_disable = halpin+".disable" self.halpin_disable = halpin_disable - pycomp.newpin(halpin_disable, HAL_BIT, HAL_IN) + pycomp.newpin(halpin_disable, Type.BOOL, Dir.IN) def update(self,pycomp): if self.disable_pin: @@ -783,7 +783,7 @@ def __init__(self,master,pycomp,halpin=None,disable_pin=False,legends=[],initval n=0 for c in legends: c_halpin=halpin+".legend"+str(n) - pycomp.newpin(c_halpin, HAL_BIT, HAL_IN) + pycomp.newpin(c_halpin, Type.BOOL, Dir.IN) self.halpins.append(c_halpin) n+=1 #limit to 6 legends @@ -795,7 +795,7 @@ def __init__(self,master,pycomp,halpin=None,disable_pin=False,legends=[],initval if disable_pin: halpin_disable = halpin+".disable" self.halpin_disable = halpin_disable - pycomp.newpin(halpin_disable, HAL_BIT, HAL_IN) + pycomp.newpin(halpin_disable, Type.BOOL, Dir.IN) # test for out of range initval number if initval >= 0 and initval <= self.num_pins : @@ -983,7 +983,7 @@ def __init__(self,master,pycomp,halpin=None, halparam=None,param_pin=0, if halparam == None: halparam = "spinbox." + str(pyvcp_spinbox.n) + ".param_pin" self.halparam=halparam - pycomp.newpin(halparam, HAL_FLOAT, HAL_IN) + pycomp.newpin(halparam, Type.REAL, Dir.IN) pyvcp_spinbox.n += 1 @@ -1005,7 +1005,7 @@ def __init__(self,master,pycomp,halpin=None, halparam=None,param_pin=0, self.min_=min_ self.resolution=resolution self.v.set( str( self.format % {'b':self.value} ) ) - pycomp.newpin(halpin, HAL_FLOAT, HAL_OUT) + pycomp.newpin(halpin, Type.REAL, Dir.OUT) self.bind('',self.wheel_up) self.bind('',self.wheel_down) @@ -1064,7 +1064,7 @@ def __init__(self,master,pycomp,halpin=None,format="2.1f",**kw): self.value=0.0 dummy = "%(b)"+self.format self.v.set( str( dummy % {'b':self.value} ) ) - pycomp.newpin(halpin, HAL_FLOAT, HAL_IN) + pycomp.newpin(halpin, Type.REAL, Dir.IN) def update(self,pycomp): newvalue = pycomp[self.halpin] @@ -1088,7 +1088,7 @@ def __init__(self,master,pycomp,halpin=None,format="d",**kw): self.value=int(0.0) dummy = "%(b)"+self.format self.v.set( str( dummy % {'b':self.value} ) ) - pycomp.newpin(halpin, HAL_U32, HAL_IN) + pycomp.newpin(halpin, Type.UINT, Dir.IN) def update(self,pycomp): newvalue = pycomp[self.halpin] @@ -1112,7 +1112,7 @@ def __init__(self,master,pycomp,halpin=None,format="d",**kw): self.value=int(0.0) dummy = "%(b)"+self.format self.v.set( str( dummy % {'b':self.value} ) ) - pycomp.newpin(halpin, HAL_S32, HAL_IN) + pycomp.newpin(halpin, Type.SINT, Dir.IN) def update(self,pycomp): newvalue = pycomp[self.halpin] @@ -1137,10 +1137,10 @@ def __init__(self,master,pycomp,halpin=None,**kw): pyvcp_timer.n += 1 self.halpins=[] c_halpin=halpin+".reset" - pycomp.newpin(c_halpin, HAL_BIT, HAL_IN) + pycomp.newpin(c_halpin, Type.BOOL, Dir.IN) self.halpins.append(c_halpin) c_halpin=halpin+".run" - pycomp.newpin(c_halpin, HAL_BIT, HAL_IN) + pycomp.newpin(c_halpin, Type.BOOL, Dir.IN) self.halpins.append(c_halpin) self.resetvalue=0 @@ -1231,7 +1231,7 @@ def __init__(self,master,pycomp,fillcolor="green",bgcolor="grey", self.startval=min_ self.format = "%" + format - pycomp.newpin(halpin, HAL_FLOAT, HAL_IN) + pycomp.newpin(halpin, Type.REAL, Dir.IN) self.value=0.0 # some dummy value to start with @@ -1346,11 +1346,11 @@ def __init__(self,master,pycomp, halpin=None,disable_pin=False, halpin = "led."+str(pyvcp_led.n) pyvcp_led.n+=1 self.halpin=halpin - pycomp.newpin(halpin, HAL_BIT, HAL_IN) + pycomp.newpin(halpin, Type.BOOL, Dir.IN) if disable_pin: halpin_disable = halpin+".disable" self.halpin_disable = halpin_disable - pycomp.newpin(halpin_disable, HAL_BIT, HAL_IN) + pycomp.newpin(halpin_disable, Type.BOOL, Dir.IN) def update(self,pycomp): @@ -1396,11 +1396,11 @@ def __init__(self,master,pycomp, halpin=None,disable_pin=False, halpin = "led."+str(pyvcp_led.n) pyvcp_led.n+=1 self.halpin=halpin - pycomp.newpin(halpin, HAL_BIT, HAL_IN) + pycomp.newpin(halpin, Type.BOOL, Dir.IN) if disable_pin: halpin_disable = halpin+".disable" self.halpin_disable = halpin_disable - pycomp.newpin(halpin_disable, HAL_BIT, HAL_IN) + pycomp.newpin(halpin_disable, Type.BOOL, Dir.IN) def update(self,pycomp): @@ -1441,10 +1441,10 @@ def __init__(self,master,pycomp,halpin=None,initval=0,**kw): if halpin == None: halpin = "checkbutton."+str(pyvcp_checkbutton.n) self.halpin=halpin - pycomp.newpin(halpin, HAL_BIT, HAL_OUT) + pycomp.newpin(halpin, Type.BOOL, Dir.OUT) changepin = halpin + ".changepin" self.changepin=changepin - pycomp.newpin(changepin, HAL_BIT, HAL_IN) + pycomp.newpin(changepin, Type.BOOL, Dir.IN) pycomp[self.changepin] = 0 pyvcp_checkbutton.n += 1 @@ -1493,11 +1493,11 @@ def __init__(self,master,pycomp,halpin=None,disable_pin=False,**kw): halpin = "button."+str(pyvcp_button.n) pyvcp_button.n += 1 self.halpin=halpin - pycomp.newpin(halpin, HAL_BIT, HAL_OUT) + pycomp.newpin(halpin, Type.BOOL, Dir.OUT) self.disable_pin = disable_pin if not disable_pin == False: halpin_disable = halpin + ".disable" - pycomp.newpin(halpin_disable, HAL_BIT, HAL_IN) + pycomp.newpin(halpin_disable, Type.BOOL, Dir.IN) self.halpin_disable=halpin_disable self.state=0; self.bind("", self.pressed) @@ -1564,12 +1564,12 @@ def __init__(self,master,pycomp, if halparam == None: halparam = "scale."+str(pyvcp_scale.n)+".param_pin" self.halparam=halparam - pycomp.newpin(halparam, HAL_FLOAT, HAL_IN) + pycomp.newpin(halparam, Type.REAL, Dir.IN) pyvcp_scale.n += 1 - pycomp.newpin(halpin+"-i", HAL_S32, HAL_OUT) - pycomp.newpin(halpin+"-f", HAL_FLOAT, HAL_OUT) + pycomp.newpin(halpin+"-i", Type.SINT, Dir.OUT) + pycomp.newpin(halpin+"-f", Type.REAL, Dir.OUT) self.bind('',self.wheel_up) self.bind('',self.wheel_down) @@ -1764,7 +1764,7 @@ def __init__(self, master, pycomp, images, halpin=None, **kw): self.halpin = halpin self.value = 0 self.last = None - pycomp.newpin(halpin, self.pintype, HAL_IN) + pycomp.newpin(halpin, self.pintype, Dir.IN) def update(self, pycomp): l = pycomp[self.halpin] @@ -1776,9 +1776,9 @@ def update(self, pycomp): self.last = l class pyvcp_image_bit(_pyvcp_image): - pintype = HAL_BIT + pintype = Type.BOOL class pyvcp_image_u32(_pyvcp_image): - pintype = HAL_U32 + pintype = Type.UINT # This must come after all the pyvcp_xxx classes elements = [] diff --git a/lib/python/qtvcp/core.py b/lib/python/qtvcp/core.py index d893f645c9c..f293484d731 100644 --- a/lib/python/qtvcp/core.py +++ b/lib/python/qtvcp/core.py @@ -5,7 +5,6 @@ from gi.repository import GObject import inspect -import _hal import hal import traceback from qtpy.QtCore import QObject, QTimer, Signal diff --git a/lib/python/qtvcp/lib/message.py b/lib/python/qtvcp/lib/message.py index 3cc844b7034..825552a3153 100644 --- a/lib/python/qtvcp/lib/message.py +++ b/lib/python/qtvcp/lib/message.py @@ -65,18 +65,18 @@ def message_setup(self, hal_comp, window=None, notify=None): # this is how we make a pin that can be connected to a callback if ("none" in details): - D._halpin = self.HAL_GCOMP_.newpin(name, hal.HAL_BIT, hal.HAL_IN) + D._halpin = self.HAL_GCOMP_.newpin(name, hal.Type.BOOL, hal.Dir.IN) else: - D._halpin = self.HAL_GCOMP_.newpin(name, hal.HAL_BIT, hal.HAL_IO) + D._halpin = self.HAL_GCOMP_.newpin(name, hal.Type.BOOL, hal.Dir.IO) D._halpin.value_changed.connect(self.messageCallback(self['dialog-{}'.format(name)], D._halpin, name, boldtext, text, pinname, details, icon)) if ("dialog" in details) and not ("nonedialog" in details): - self.HAL_GCOMP_.newpin(name + "-waiting", hal.HAL_BIT, hal.HAL_OUT) + self.HAL_GCOMP_.newpin(name + "-waiting", hal.Type.BOOL, hal.Dir.OUT) if not ("ok" in details): - self.HAL_GCOMP_.newpin(name + "-response", hal.HAL_BIT, hal.HAL_OUT) - self.HAL_GCOMP_.newpin(name + "-response-s32", hal.HAL_S32, hal.HAL_OUT) + self.HAL_GCOMP_.newpin(name + "-response", hal.Type.BOOL, hal.Dir.OUT) + self.HAL_GCOMP_.newpin(name + "-response-s32", hal.Type.SINT, hal.Dir.OUT) self.HAL_GCOMP_[name + "-response-s32"] = -1 # undetermined if not INFO.USRMULTIMESS_ID is None: @@ -88,13 +88,13 @@ def message_setup(self, hal_comp, window=None, notify=None): D.hal_init(HAL_NAME=name) D.pinname = name - D._halpin = self.HAL_GCOMP_.newpin(name, hal.HAL_S32, hal.HAL_IN) + D._halpin = self.HAL_GCOMP_.newpin(name, hal.Type.SINT, hal.Dir.IN) D._halpin.value_changed.connect(self.multiMessageCallback(D, D._halpin, name, mess, )) if ("dialog" in details) and not ("nonedialog" in details): - self.HAL_GCOMP_.newpin(name + "-waiting", hal.HAL_BIT, hal.HAL_OUT) + self.HAL_GCOMP_.newpin(name + "-waiting", hal.Type.BOOL, hal.Dir.OUT) # This weird code is so we can get access to proper variables. # using clicked.connect( self.on_printmessage(pin,name,bt,t,c) ) apparently doesn't easily diff --git a/lib/python/qtvcp/lib/qt_vismach/fanuc_200f.py b/lib/python/qtvcp/lib/qt_vismach/fanuc_200f.py index bc540a84763..ae22fdb0bc7 100755 --- a/lib/python/qtvcp/lib/qt_vismach/fanuc_200f.py +++ b/lib/python/qtvcp/lib/qt_vismach/fanuc_200f.py @@ -27,14 +27,14 @@ BASEPATH = os.path.join(os.path.dirname(__file__), 'fanuc_200f_obj') c = hal.component("fanuc_200f") -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint6", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("grip", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("plotclear", hal.HAL_BIT, hal.HAL_IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint3", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint4", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint5", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint6", hal.Type.REAL, hal.Dir.IN) +c.newpin("grip", hal.Type.REAL, hal.Dir.IN) +c.newpin("plotclear", hal.Type.BOOL, hal.Dir.IN) c.ready() diff --git a/lib/python/qtvcp/lib/qt_vismach/gantry_5axis.py b/lib/python/qtvcp/lib/qt_vismach/gantry_5axis.py index dd290e695c1..aee2fad223b 100755 --- a/lib/python/qtvcp/lib/qt_vismach/gantry_5axis.py +++ b/lib/python/qtvcp/lib/qt_vismach/gantry_5axis.py @@ -41,14 +41,14 @@ def coords(self): return -self.comp.tool_length, r, 0, r c = hal.component("5axisgui") -c.newpin("jx", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jy", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jz", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jb", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jc", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool_length", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool_diam", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("pivot_len", hal.HAL_FLOAT, hal.HAL_OUT) +c.newpin("jx", hal.Type.REAL, hal.Dir.IN) +c.newpin("jy", hal.Type.REAL, hal.Dir.IN) +c.newpin("jz", hal.Type.REAL, hal.Dir.IN) +c.newpin("jb", hal.Type.REAL, hal.Dir.IN) +c.newpin("jc", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool_length", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool_diam", hal.Type.REAL, hal.Dir.IN) +c.newpin("pivot_len", hal.Type.REAL, hal.Dir.OUT) c["pivot_len"] = pivot_len c.ready() diff --git a/lib/python/qtvcp/lib/qt_vismach/millturn.py b/lib/python/qtvcp/lib/qt_vismach/millturn.py index 438755e61d4..b5211ed749f 100755 --- a/lib/python/qtvcp/lib/qt_vismach/millturn.py +++ b/lib/python/qtvcp/lib/qt_vismach/millturn.py @@ -19,18 +19,18 @@ # add joints. Mill has 3. c = hal.component("millturngui") # follow ZYX directly -#c.newpin("jointX", hal.HAL_FLOAT, hal.HAL_IN) -#c.newpin("jointY", hal.HAL_FLOAT, hal.HAL_IN) -#c.newpin("jointZ", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jointA", hal.HAL_FLOAT, hal.HAL_IN) +#c.newpin("jointX", hal.Type.REAL, hal.Dir.IN) +#c.newpin("jointY", hal.Type.REAL, hal.Dir.IN) +#c.newpin("jointZ", hal.Type.REAL, hal.Dir.IN) +c.newpin("jointA", hal.Type.REAL, hal.Dir.IN) # kinematics pins -c.newpin("millkins", hal.HAL_BIT, hal.HAL_IN) +c.newpin("millkins", hal.Type.BOOL, hal.Dir.IN) # tool length and diameter pins? -c.newpin("toollength", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tooldiameter", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool-x-offset", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("toollength", hal.Type.REAL, hal.Dir.IN) +c.newpin("tooldiameter", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool-x-offset", hal.Type.REAL, hal.Dir.IN) # tells loadusr pins is ready c.ready() diff --git a/lib/python/qtvcp/qt_halobjects.py b/lib/python/qtvcp/qt_halobjects.py index 64b5bb0d28e..38846757bc9 100644 --- a/lib/python/qtvcp/qt_halobjects.py +++ b/lib/python/qtvcp/qt_halobjects.py @@ -114,16 +114,21 @@ def get_name(self): return self._a[0] class _QHal(object): - HAL_BIT = hal.HAL_BIT - HAL_FLOAT = hal.HAL_FLOAT - HAL_S32 = hal.HAL_S32 - HAL_U32 = hal.HAL_U32 - - HAL_IN = hal.HAL_IN - HAL_OUT = hal.HAL_OUT - HAL_IO = hal.HAL_IO - HAL_RO = hal.HAL_RO - HAL_RW = hal.HAL_RW + HAL_BOOL = hal.Type.BOOL + HAL_REAL = hal.Type.REAL + HAL_SINT = hal.Type.SINT + HAL_UINT = hal.Type.UINT + + HAL_BIT = hal.Type.BOOL # Deprecated + HAL_FLOAT = hal.Type.REAL # Deprecated + HAL_S32 = hal.Type.SINT # Replaced by hal.Type.SINT + HAL_U32 = hal.Type.UINT # Replaced by hal.Type.UINT + + HAL_IN = hal.Dir.IN + HAL_OUT = hal.Dir.OUT + HAL_IO = hal.Dir.IO + HAL_RO = hal.Dir.RO + HAL_RW = hal.Dir.RW def __new__(cls, *a, **kw): instance = super(_QHal, cls).__new__(cls) diff --git a/lib/python/qtvcp/widgets/axis_tool_button.py b/lib/python/qtvcp/widgets/axis_tool_button.py index d2c58f7a55b..20411a62bdc 100644 --- a/lib/python/qtvcp/widgets/axis_tool_button.py +++ b/lib/python/qtvcp/widgets/axis_tool_button.py @@ -131,8 +131,8 @@ def homed_on_test(): else: pname = self._pin_name_ - self.hal_pin_joint = self.HAL_GCOMP_.newpin(str(pname + '-joint'), hal.HAL_BIT, hal.HAL_OUT) - self.hal_pin_axis = self.HAL_GCOMP_.newpin(str(pname + '-axis'), hal.HAL_BIT, hal.HAL_OUT) + self.hal_pin_joint = self.HAL_GCOMP_.newpin(str(pname + '-joint'), hal.Type.BOOL, hal.Dir.OUT) + self.hal_pin_axis = self.HAL_GCOMP_.newpin(str(pname + '-axis'), hal.Type.BOOL, hal.Dir.OUT) STATUS.connect('general',self.return_value) def _enableGroup(self, state,bstate): diff --git a/lib/python/qtvcp/widgets/bar.py b/lib/python/qtvcp/widgets/bar.py index 36a1a83020a..1d59c283c2b 100644 --- a/lib/python/qtvcp/widgets/bar.py +++ b/lib/python/qtvcp/widgets/bar.py @@ -408,8 +408,10 @@ def resetVert(self): class HALPinType(enum.IntEnum): NONE = 0 - S32 = hal.HAL_S32 - FLOAT = hal.HAL_FLOAT + S32 = hal.Type.SINT # Removed + FLOAT= hal.Type.REAL # Deprecated + SINT = hal.Type.SINT + REAL = hal.Type.REAL class HalBar(Bar, _HalWidgetBase): @@ -418,12 +420,14 @@ class HalBar(Bar, _HalWidgetBase): # older version of pyqt5 need this as well as QEnum NONE = 0 - S32 = hal.HAL_S32 - FLOAT = hal.HAL_FLOAT + S32 = hal.Type.SINT # Removed + FLOAT= hal.Type.REAL # Deprecated + SINT = hal.Type.SINT + REAL = hal.Type.REAL def __init__(self, *args, **kwargs): super(). __init__( *args, **kwargs) - self._pin_type = HALPinType.S32 + self._pin_type = HALPinType.SINT self._pin_name = '' self._invert_negative = False self._superOpposite = self._opposite @@ -436,11 +440,11 @@ def _hal_init(self): self._superOpposite = self._opposite - if self._pin_type == HALPinType.FLOAT: - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_FLOAT, hal.HAL_IN) + if self._pin_type == HALPinType.REAL: + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.REAL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self.updateDisplay(data)) - elif self._pin_type == HALPinType.S32: - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_S32, hal.HAL_IN) + elif self._pin_type == HALPinType.SINT: + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.SINT, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self.updateDisplay(data)) def updateDisplay(self, data): @@ -456,7 +460,7 @@ def set_pin_type(self, value): def get_pin_type(self): return self._pin_type def reset_pin_type(self): - self._pin_type = HALPinType.S32 + self._pin_type = HALPinType.SINT def set_pin_name(self, value): self._pin_name = value diff --git a/lib/python/qtvcp/widgets/basic_probe.py b/lib/python/qtvcp/widgets/basic_probe.py index 74f93959ad6..1e9a2bddce9 100644 --- a/lib/python/qtvcp/widgets/basic_probe.py +++ b/lib/python/qtvcp/widgets/basic_probe.py @@ -198,7 +198,7 @@ def homed_on_status(): # make pins available for tool measure remaps oldname = self.HAL_GCOMP_.comp.getprefix() self.HAL_GCOMP_.comp.setprefix('qtbasicprobe') - self.probe_loaded = self.HAL_GCOMP_.newpin("probe-loaded", hal.HAL_BIT, hal.HAL_OUT) + self.probe_loaded = self.HAL_GCOMP_.newpin("probe-loaded", hal.Type.BOOL, hal.Dir.OUT) self.HAL_GCOMP_.comp.setprefix(oldname) # get current style of the line input diff --git a/lib/python/qtvcp/widgets/camview_widget.py b/lib/python/qtvcp/widgets/camview_widget.py index 5e11ef65437..0e0fe25e539 100644 --- a/lib/python/qtvcp/widgets/camview_widget.py +++ b/lib/python/qtvcp/widgets/camview_widget.py @@ -98,7 +98,7 @@ def __init__(self, parent=None): def _hal_init(self): try: - self.pin_ = self.HAL_GCOMP_.newpin('cam-rotation',hal.HAL_FLOAT, hal.HAL_OUT) + self.pin_ = self.HAL_GCOMP_.newpin('cam-rotation',hal.Type.REAL, hal.Dir.OUT) except: pass if LIB_GOOD: diff --git a/lib/python/qtvcp/widgets/dialog_widget.py b/lib/python/qtvcp/widgets/dialog_widget.py index c281869bfcb..bbe9a05e167 100644 --- a/lib/python/qtvcp/widgets/dialog_widget.py +++ b/lib/python/qtvcp/widgets/dialog_widget.py @@ -441,11 +441,11 @@ def _hal_init(self): if not hal.component_exists('hal_manualtoolchange'): oldname = self.HAL_GCOMP_.comp.getprefix() self.HAL_GCOMP_.comp.setprefix('hal_manualtoolchange') - self.hal_pin = self.HAL_GCOMP_.newpin('change', hal.HAL_BIT, hal.HAL_IN) + self.hal_pin = self.HAL_GCOMP_.newpin('change', hal.Type.BOOL, hal.Dir.IN) self.hal_pin.value_changed.connect(self.tool_change) - self.tool_number = self.HAL_GCOMP_.newpin('number', hal.HAL_S32, hal.HAL_IN) - self.changed = self.HAL_GCOMP_.newpin('changed', hal.HAL_BIT, hal.HAL_OUT) - self.ext_ack = self.HAL_GCOMP_.newpin(self.HAL_NAME_ + 'change_button', hal.HAL_BIT, hal.HAL_IN) + self.tool_number = self.HAL_GCOMP_.newpin('number', hal.Type.SINT, hal.Dir.IN) + self.changed = self.HAL_GCOMP_.newpin('changed', hal.Type.BOOL, hal.Dir.OUT) + self.ext_ack = self.HAL_GCOMP_.newpin(self.HAL_NAME_ + 'change_button', hal.Type.BOOL, hal.Dir.IN) self.ext_ack.value_changed.connect(self.external_acknowledge) self.HAL_GCOMP_.comp.setprefix(oldname) else: diff --git a/lib/python/qtvcp/widgets/general_hal_input.py b/lib/python/qtvcp/widgets/general_hal_input.py index 2da821acc0d..3f8cd3be73e 100644 --- a/lib/python/qtvcp/widgets/general_hal_input.py +++ b/lib/python/qtvcp/widgets/general_hal_input.py @@ -48,14 +48,14 @@ def _hal_init(self): else: pname = self._pin_name if self._bit_pin_type: - ptype = hal.HAL_BIT - self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_, hal.HAL_BIT, hal.HAL_IN) + ptype = hal.Type.BOOL + self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_, hal.Type.BOOL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self.pin_update(data)) elif self._float_pin_type: - self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_, hal.HAL_FLOAT, hal.HAL_IN) + self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_, hal.Type.REAL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self.pin_update(data)) else: - self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_, hal.HAL_S32, hal.HAL_IN) + self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_, hal.Type.SINT, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self.pin_update(data)) def pin_update(self, *a): diff --git a/lib/python/qtvcp/widgets/general_hal_output.py b/lib/python/qtvcp/widgets/general_hal_output.py index 4133cd6979e..bf555cf3d6d 100644 --- a/lib/python/qtvcp/widgets/general_hal_output.py +++ b/lib/python/qtvcp/widgets/general_hal_output.py @@ -47,16 +47,16 @@ def _hal_init(self): else: pname = self._pin_name if self._bit_pin_type: - ptype = hal.HAL_BIT - self.hal_pin = self.HAL_GCOMP_.newpin(pname, ptype, hal.HAL_OUT) - self.hal_pin_2 = self.HAL_GCOMP_.newpin(pname + "-not", ptype, hal.HAL_OUT) + ptype = hal.Type.BOOL + self.hal_pin = self.HAL_GCOMP_.newpin(pname, ptype, hal.Dir.OUT) + self.hal_pin_2 = self.HAL_GCOMP_.newpin(pname + "-not", ptype, hal.Dir.OUT) if self.istate: self._pin_bit_update(self._initial_float) else: - ptype = hal.HAL_S32 - ptype2 = hal.HAL_FLOAT - self.hal_pin = self.HAL_GCOMP_.newpin(pname + '-s32', ptype, hal.HAL_OUT) - self.hal_pin_2 = self.HAL_GCOMP_.newpin(pname + "-float", ptype2, hal.HAL_OUT) + ptype = hal.Type.SINT + ptype2 = hal.Type.REAL + self.hal_pin = self.HAL_GCOMP_.newpin(pname + '-s32', ptype, hal.Dir.OUT) + self.hal_pin_2 = self.HAL_GCOMP_.newpin(pname + "-float", ptype2, hal.Dir.OUT) if self.istate: self._pin_value_update(self._initial_float) diff --git a/lib/python/qtvcp/widgets/hal_label.py b/lib/python/qtvcp/widgets/hal_label.py index c35ac341d75..add3f4fc664 100644 --- a/lib/python/qtvcp/widgets/hal_label.py +++ b/lib/python/qtvcp/widgets/hal_label.py @@ -49,13 +49,13 @@ def _hal_init(self): else: pname = self._pin_name if self._bit_pin_type: - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_BIT, hal.HAL_IN) + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.BOOL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self._setText(data)) elif self._float_pin_type: - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_FLOAT, hal.HAL_IN) + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.REAL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self._setText(data)) elif self._s32_pin_type or self._use_multi_label: - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_S32, hal.HAL_IN) + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.SINT, hal.Dir.IN) if self._s32_pin_type: self.hal_pin.value_changed.connect(lambda data: self._setText(data)) else: diff --git a/lib/python/qtvcp/widgets/hal_selectionbox.py b/lib/python/qtvcp/widgets/hal_selectionbox.py index 3bb466ed9e9..260f46bff26 100644 --- a/lib/python/qtvcp/widgets/hal_selectionbox.py +++ b/lib/python/qtvcp/widgets/hal_selectionbox.py @@ -106,16 +106,21 @@ def selected(self,index): ################################################################ class HALSelectionBox(TreeComboBox, _HalWidgetBase): - HAL_BIT = hal.HAL_BIT - HAL_FLOAT = hal.HAL_FLOAT - HAL_S32 = hal.HAL_S32 - HAL_U32 = hal.HAL_U32 - - HAL_IN = hal.HAL_IN - HAL_OUT = hal.HAL_OUT - HAL_IO = hal.HAL_IO - HAL_RO = hal.HAL_RO - HAL_RW = hal.HAL_RW + HAL_BOOL = hal.Type.BOOL + HAL_REAL = hal.Type.REAL + HAL_SINT = hal.Type.SINT + HAL_UINT = hal.Type.UINT + + HAL_BIT = hal.Type.BOOL # Deprecated + HAL_FLOAT = hal.Type.REAL # Deprecated + HAL_S32 = hal.Type.SINT # Replaced by hal.Type.SINT + HAL_U32 = hal.Type.UINT # Replaced by hal.Type.SINT + + HAL_IN = hal.Dir.IN + HAL_OUT = hal.Dir.OUT + HAL_IO = hal.Dir.IO + HAL_RO = hal.Dir.RO + HAL_RW = hal.Dir.RW PINS = 1 SIGS = SIGNALS = 2 @@ -123,9 +128,9 @@ class HALSelectionBox(TreeComboBox, _HalWidgetBase): def __init__(self, parent=None): super(HALSelectionBox, self).__init__(parent) - self.PINTYPE = [self.HAL_BIT,self.HAL_FLOAT,self.HAL_S32,self.HAL_U32] + self.PINTYPE = [self.HAL_BOOL,self.HAL_REAL,self.HAL_SINT,self.HAL_UINT] self.PINDIRECTION = [self.HAL_IN, self.HAL_OUT] - self.SIGTYPE = [self.HAL_BIT,self.HAL_FLOAT,self.HAL_S32,self.HAL_U32] + self.SIGTYPE = [self.HAL_BOOL,self.HAL_REAL,self.HAL_SINT,self.HAL_UINT] self.SIGDRIVEN = [True, False] self.PARAMTYPE = [self.HAL_RO, self.HAL_RW] self.SHOWTYPES = [self.PINS] @@ -187,30 +192,30 @@ def _hal_init(self): self.view().adjustSize() def setShowTypes(self, types): - ''' Sets the pin type: HAL_BIT,HAL_FLOAT,HAL_S32,HAL_U32 + ''' Sets the pin type: HAL_BOOL,HAL_REAL,HAL_SINT,HAL_UINT that will be shown in the combbox. widget defaults to all pin types shown - ie. combobox.setShowTypes([combobox.HAL_BIT])''' + ie. combobox.setShowTypes([combobox.HAL_BOOL])''' self.SHOWTYPES = types def setPinTypes(self, \ - types = [HAL_BIT,HAL_FLOAT,HAL_S32,HAL_U32], \ + types = [HAL_BOOL,HAL_REAL,HAL_SINT,HAL_UINT], \ direction = [HAL_IN, HAL_OUT]): - ''' Sets the pin type: HAL_BIT,HAL_FLOAT,HAL_S32,HAL_U32 + ''' Sets the pin type: HAL_BOOL,HAL_REAL,HAL_SINT,HAL_UINT and direction: HAL_IN, HAL_OUT that will be shown in combobox. widget defaults to all pins, all directions. - ie. combobox.setPinTypes([combobox.HAL_BIT], direction = [HAL_IN])''' + ie. combobox.setPinTypes([combobox.HAL_BOOL], direction = [HAL_IN])''' self.PINTYPE = types self.PINDIRECTION = direction def setSignalTypes(self, \ - types = [HAL_BIT,HAL_FLOAT,HAL_S32,HAL_U32], \ + types = [HAL_BOOL,HAL_REAL,HAL_SINT,HAL_UINT], \ driven = [True, False]): - ''' Sets the pin type: HAL_BIT,HAL_FLOAT,HAL_S32,HAL_U32 + ''' Sets the pin type: HAL_BOOL,HAL_REAL,HAL_SINT,HAL_UINT and what type of signals (driven by a pin, not or both). True being driven and False being un-driven signals - combobox.setSignalTypes([combobox.HAL_BIT], direction = [True,False])''' + combobox.setSignalTypes([combobox.HAL_BOOL], direction = [True,False])''' self.SIGTYPE = types self.SIGDRIVEN = driven diff --git a/lib/python/qtvcp/widgets/indicatorMixIn.py b/lib/python/qtvcp/widgets/indicatorMixIn.py index bda4fd8172e..89db9755b97 100644 --- a/lib/python/qtvcp/widgets/indicatorMixIn.py +++ b/lib/python/qtvcp/widgets/indicatorMixIn.py @@ -116,10 +116,10 @@ def _hal_init(self): pname = self.HAL_NAME_ else: pname = self._pin_name_ - self.hal_pin_led = self.HAL_GCOMP_.newpin(pname + '-led', hal.HAL_BIT, hal.HAL_IN) + self.hal_pin_led = self.HAL_GCOMP_.newpin(pname + '-led', hal.Type.BOOL, hal.Dir.IN) self.hal_pin_led.value_changed.connect(lambda data: self.indicator_update(data)) if self._doubleIndicator: - self.hal_pin_led2 = self.HAL_GCOMP_.newpin(pname + '-led2', hal.HAL_BIT, hal.HAL_IN) + self.hal_pin_led2 = self.HAL_GCOMP_.newpin(pname + '-led2', hal.Type.BOOL, hal.Dir.IN) self.hal_pin_led2.value_changed.connect(lambda data: self.indicator2_update(data)) elif self._ind_status: diff --git a/lib/python/qtvcp/widgets/jog_increments.py b/lib/python/qtvcp/widgets/jog_increments.py index c54caa3ba93..05a079d6a56 100644 --- a/lib/python/qtvcp/widgets/jog_increments.py +++ b/lib/python/qtvcp/widgets/jog_increments.py @@ -51,7 +51,7 @@ def _hal_init(self): pname = self.HAL_NAME_ else: pname = self._pin_name - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_FLOAT, hal.HAL_OUT) + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.REAL, hal.Dir.OUT) if self.linear: for item in (INFO.JOG_INCREMENTS): self.addItem(item) diff --git a/lib/python/qtvcp/widgets/joypad.py b/lib/python/qtvcp/widgets/joypad.py index fd35549ebc2..85620e61b8e 100644 --- a/lib/python/qtvcp/widgets/joypad.py +++ b/lib/python/qtvcp/widgets/joypad.py @@ -539,9 +539,12 @@ def __setitem__(self, item, value): class HALPinType(enum.IntEnum): NONE = 0 - BIT = hal.HAL_BIT - S32 = hal.HAL_S32 - FLOAT = hal.HAL_FLOAT + BIT = hal.Type.BOOL # Deprecated + S32 = hal.Type.SINT # Removed + FLOAT= hal.Type.REAL # Deprecated + BOOL = hal.Type.BOOL + SINT = hal.Type.SINT + REAL = hal.Type.REAL class HALPad(JoyPad, _HalWidgetBase): HALPinType = HALPinType @@ -549,14 +552,17 @@ class HALPad(JoyPad, _HalWidgetBase): # older version of pyqt5 need this as well as QEnum NONE = 0 - BIT = hal.HAL_BIT - S32 = hal.HAL_S32 - FLOAT = hal.HAL_FLOAT + BIT = hal.Type.BOOL # Deprecated + S32 = hal.Type.SINT # Removed + FLOAT= hal.Type.REAL # Deprecated + BOOL = hal.Type.BOOL + SINT = hal.Type.SINT + REAL = hal.Type.REAL def __init__(self, parent=None): super(HALPad, self).__init__(parent) self._pin_name = '' - self._pin_type = HALPinType.BIT + self._pin_type = HALPinType.BOOL self._trueOutputR = 1.0 self._trueOutputL = 1.0 @@ -579,24 +585,24 @@ def _hal_init(self): pname = self._pin_name if not self._pin_type == HALPinType.NONE: ptype = self._pin_type - self.halPinR = self.HAL_GCOMP_.newpin(pname + '.right', ptype, hal.HAL_OUT) - self.halPinL = self.HAL_GCOMP_.newpin(pname + '.left', ptype, hal.HAL_OUT) - self.halPinT = self.HAL_GCOMP_.newpin(pname + '.top', ptype, hal.HAL_OUT) - self.halPinB = self.HAL_GCOMP_.newpin(pname + '.bottom', ptype, hal.HAL_OUT) - self.halPinC = self.HAL_GCOMP_.newpin(pname + '.center', ptype, hal.HAL_OUT) + self.halPinR = self.HAL_GCOMP_.newpin(pname + '.right', ptype, hal.Dir.OUT) + self.halPinL = self.HAL_GCOMP_.newpin(pname + '.left', ptype, hal.Dir.OUT) + self.halPinT = self.HAL_GCOMP_.newpin(pname + '.top', ptype, hal.Dir.OUT) + self.halPinB = self.HAL_GCOMP_.newpin(pname + '.bottom', ptype, hal.Dir.OUT) + self.halPinC = self.HAL_GCOMP_.newpin(pname + '.center', ptype, hal.Dir.OUT) if not self._highlightPosition == IndicatorPosition.NONE: - self.halPinLightCenter = self.HAL_GCOMP_.newpin(pname + '.light.center', hal.HAL_BIT, hal.HAL_IN) + self.halPinLightCenter = self.HAL_GCOMP_.newpin(pname + '.light.center', hal.Type.BOOL, hal.Dir.IN) self.halPinLightCenter.value_changed.connect(lambda data: self.setLight(data)) def _pressedOutput(self, btncode): self.joy_btn_pressed.emit(btncode) self['joy_{}_pressed'.format(btncode.lower())].emit(True) - if self._pin_type == HALPinType.BIT: + if self._pin_type == HALPinType.BOOL: data = True - elif self._pin_type == HALPinType.FLOAT: + elif self._pin_type == HALPinType.REAL: data = float(self['_trueOutput{}'.format(btncode)]) - elif self._pin_type == HALPinType.S32: + elif self._pin_type == HALPinType.SINT: data = int(self['_trueOutput{}'.format(btncode)]) else: return @@ -609,11 +615,11 @@ def _releasedOutput(self, btncode): self.joy_btn_released.emit(btncode) self['joy_{}_released'.format(btncode.lower())].emit(False) - if self._pin_type == HALPinType.BIT: + if self._pin_type == HALPinType.BOOL: data = False - elif self._pin_type == HALPinType.FLOAT: + elif self._pin_type == HALPinType.REAL: data = float(self._falseOutput) - elif self._pin_type == HALPinType.S32: + elif self._pin_type == HALPinType.SINT: data = int(self._falseOutput) else: return @@ -645,7 +651,7 @@ def set_pin_type(self, value): def get_pin_type(self): return self._pin_type def reset_pin_type(self): - self._pin_type = HALPinType.BIT + self._pin_type = HALPinType.BOOL # designer will show these properties in this order: pin_type = QtCore.Property(HALPinType, get_pin_type, set_pin_type, reset_pin_type) diff --git a/lib/python/qtvcp/widgets/led_widget.py b/lib/python/qtvcp/widgets/led_widget.py index 6c55ee8b1aa..bc4409f7074 100644 --- a/lib/python/qtvcp/widgets/led_widget.py +++ b/lib/python/qtvcp/widgets/led_widget.py @@ -64,7 +64,7 @@ def _hal_init(self): else: pname = self._pin_name_ - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_BIT, hal.HAL_IN) + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.BOOL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda s: self.change_state(s)) @Slot(bool) diff --git a/lib/python/qtvcp/widgets/round_gauge.py b/lib/python/qtvcp/widgets/round_gauge.py index 04f3ed64187..f0268f083f2 100644 --- a/lib/python/qtvcp/widgets/round_gauge.py +++ b/lib/python/qtvcp/widgets/round_gauge.py @@ -37,9 +37,9 @@ def __init__(self, parent=None): def _hal_init(self): if (self._halpin_option): - self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_ + "_value", hal.HAL_FLOAT, hal.HAL_IN) + self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_ + "_value", hal.Type.REAL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda value: self.update_value(value)) - self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_ + "_setpoint", hal.HAL_FLOAT, hal.HAL_IN) + self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_ + "_setpoint", hal.Type.REAL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda value: self.set_setpoint(value)) def create_unit_array(self): diff --git a/lib/python/qtvcp/widgets/simple_widgets.py b/lib/python/qtvcp/widgets/simple_widgets.py index 8af83620e10..3e814efee42 100644 --- a/lib/python/qtvcp/widgets/simple_widgets.py +++ b/lib/python/qtvcp/widgets/simple_widgets.py @@ -45,9 +45,12 @@ class HALPinType(enum.IntEnum): NONE = 0 - BIT = hal.HAL_BIT - S32 = hal.HAL_S32 - FLOAT = hal.HAL_FLOAT + BIT = hal.Type.BOOL # Deprecated + S32 = hal.Type.SINT # Removed + FLOAT= hal.Type.REAL # Deprecated + BOOL = hal.Type.BOOL + SINT = hal.Type.SINT + REAL = hal.Type.REAL # reacts to HAL pin changes class LCDNumber(QtWidgets.QLCDNumber, _HalWidgetBase): @@ -64,13 +67,13 @@ def _hal_init(self): else: pname = self._pin_name_ if self._bit_pin_type: - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_BIT, hal.HAL_IN) + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.BOOL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self.updateDisplay(data)) elif self._float_pin_type: - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_FLOAT, hal.HAL_IN) + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.REAL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self.updateFloatDisplay(data)) elif self._s32_pin_type: - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_S32, hal.HAL_IN) + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.SINT, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self.updateDisplay(data)) def updateDisplay(self, data): @@ -177,9 +180,9 @@ def _hal_init(self): pname = self.HAL_NAME_ else: pname = self._pin_name_ - self.hal_pin_s = self.HAL_GCOMP_.newpin(str(pname +'-s'), hal.HAL_S32, hal.HAL_OUT) - self.hal_pin_f = self.HAL_GCOMP_.newpin(pname +'-f', hal.HAL_FLOAT, hal.HAL_OUT) - self.hal_pin_scale = self.HAL_GCOMP_.newpin(pname +'-scale', hal.HAL_FLOAT, hal.HAL_IN) + self.hal_pin_s = self.HAL_GCOMP_.newpin(str(pname +'-s'), hal.Type.SINT, hal.Dir.OUT) + self.hal_pin_f = self.HAL_GCOMP_.newpin(pname +'-f', hal.Type.REAL, hal.Dir.OUT) + self.hal_pin_scale = self.HAL_GCOMP_.newpin(pname +'-scale', hal.Type.REAL, hal.Dir.IN) self.hal_pin_scale.set(1) self.updateValue(self.value()) self.valueChanged.connect(lambda data:self.updateValue(data)) @@ -212,10 +215,10 @@ def _hal_init(self): pname = self.HAL_NAME_ else: pname = self._pin_name_ - self.hal_pin_s = self.HAL_GCOMP_.newpin(str(pname +'-s'), hal.HAL_S32, hal.HAL_OUT) - self.hal_pin_f = self.HAL_GCOMP_.newpin(pname +'-f', hal.HAL_FLOAT, hal.HAL_OUT) - self.hal_pin_d = self.HAL_GCOMP_.newpin(pname +'-d', hal.HAL_FLOAT, hal.HAL_OUT) - self.hal_pin_scale = self.HAL_GCOMP_.newpin(pname +'-scale', hal.HAL_FLOAT, hal.HAL_IN) + self.hal_pin_s = self.HAL_GCOMP_.newpin(str(pname +'-s'), hal.Type.SINT, hal.Dir.OUT) + self.hal_pin_f = self.HAL_GCOMP_.newpin(pname +'-f', hal.Type.REAL, hal.Dir.OUT) + self.hal_pin_d = self.HAL_GCOMP_.newpin(pname +'-d', hal.Type.REAL, hal.Dir.OUT) + self.hal_pin_scale = self.HAL_GCOMP_.newpin(pname +'-scale', hal.Type.REAL, hal.Dir.IN) self.hal_pin_scale.value_changed.connect(lambda data: self.updateScale(data)) self.hal_pin_scale.set(1) self.updateCount(self.value()) @@ -359,14 +362,17 @@ class PushButton(QtWidgets.QPushButton, IndicatedMixIn): # older version of pyqt5 need this as well as QEnum NONE = 0 - BIT = hal.HAL_BIT - S32 = hal.HAL_S32 - FLOAT = hal.HAL_FLOAT + BIT = hal.Type.BOOL # Deprecated + S32 = hal.Type.SINT # Removed + FLOAT= hal.Type.REAL # Deprecated + BOOL = hal.Type.BOOL + SINT = hal.Type.SINT + REAL = hal.Type.REAL def __init__(self, parent=None): super(PushButton, self).__init__(parent) - self._pin_type = HALPinType.S32 + self._pin_type = HALPinType.SINT self._groupPinName = '' self._exclusiveValue = 0.0 self.halPinGroup = None @@ -397,7 +403,7 @@ def _hal_init(self): pname = self.HAL_NAME_ else: pname = self._pin_name_ - self.hal_pin = self.HAL_GCOMP_.newpin(str(pname), hal.HAL_BIT, hal.HAL_OUT) + self.hal_pin = self.HAL_GCOMP_.newpin(str(pname), hal.Type.BOOL, hal.Dir.OUT) super(PushButton, self)._hal_init() @@ -434,7 +440,7 @@ def makeGroupPin(self): pname = self.HAL_NAME_ + '.exclusive'+name else: pname = self._groupPinName - self.halPinGroup = self.HAL_GCOMP_.newpin(pname , ptype, hal.HAL_OUT) + self.halPinGroup = self.HAL_GCOMP_.newpin(pname , ptype, hal.Dir.OUT) break break @@ -452,11 +458,11 @@ def updateGroup(self): #print('value:',value) break - if self._pin_type == HALPinType.BIT: + if self._pin_type == HALPinType.BOOL: data = bool(value) - elif self._pin_type == HALPinType.FLOAT: + elif self._pin_type == HALPinType.REAL: data = float(value) - elif self._pin_type == HALPinType.S32: + elif self._pin_type == HALPinType.SINT: data = int(value) else: return @@ -479,7 +485,7 @@ def set_pin_type(self, value): def get_pin_type(self): return self._pin_type def reset_pin_type(self): - self._pin_type = HALPinType.S32 + self._pin_type = HALPinType.SINT # designer will show these properties in this order: pin_type = QtCore.Property(HALPinType, get_pin_type, set_pin_type, reset_pin_type) diff --git a/lib/python/qtvcp/widgets/state_led.py b/lib/python/qtvcp/widgets/state_led.py index ab6b9c2668a..6a1bddd24fd 100644 --- a/lib/python/qtvcp/widgets/state_led.py +++ b/lib/python/qtvcp/widgets/state_led.py @@ -83,7 +83,7 @@ def only_false(data): pname = self.HAL_NAME_ else: pname = self._halpin_name - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_BIT, hal.HAL_OUT) + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.BOOL, hal.Dir.OUT) if self.is_estopped: STATUS.connect('state-estop', lambda w: self._flip_state(True)) STATUS.connect('state-estop-reset', lambda w: self._flip_state(False)) diff --git a/lib/python/qtvcp/widgets/status_slider.py b/lib/python/qtvcp/widgets/status_slider.py index fa1b93571e8..6daa2fad754 100644 --- a/lib/python/qtvcp/widgets/status_slider.py +++ b/lib/python/qtvcp/widgets/status_slider.py @@ -121,7 +121,7 @@ def _hal_init(self): pname = self.HAL_NAME_ else: pname = self._pin_name_ - self.hal_pin = self.HAL_GCOMP_.newpin(str(pname), hal.HAL_FLOAT, hal.HAL_OUT) + self.hal_pin = self.HAL_GCOMP_.newpin(str(pname), hal.Type.REAL, hal.Dir.OUT) # connect a signal and callback function to the button self.doubleValueChanged.connect(self._action) diff --git a/lib/python/qtvcp/widgets/versa_probe.py b/lib/python/qtvcp/widgets/versa_probe.py index efa18563d06..8528226a3a3 100644 --- a/lib/python/qtvcp/widgets/versa_probe.py +++ b/lib/python/qtvcp/widgets/versa_probe.py @@ -234,17 +234,17 @@ def homed_on_test(): # make pins available for tool measure remaps oldname = self.HAL_GCOMP_.comp.getprefix() self.HAL_GCOMP_.comp.setprefix('qtversaprobe') - self.pin_svel = self.HAL_GCOMP_.newpin("searchvel", hal.HAL_FLOAT, hal.HAL_OUT) + self.pin_svel = self.HAL_GCOMP_.newpin("searchvel", hal.Type.REAL, hal.Dir.OUT) self.pin_svel.set(float(self.input_search_vel.text())) - self.pin_pvel = self.HAL_GCOMP_.newpin("probevel", hal.HAL_FLOAT, hal.HAL_OUT) + self.pin_pvel = self.HAL_GCOMP_.newpin("probevel", hal.Type.REAL, hal.Dir.OUT) self.pin_pvel.set(float(self.input_probe_vel.text())) - self.pin_pheight = self.HAL_GCOMP_.newpin("probeheight", hal.HAL_FLOAT, hal.HAL_OUT) + self.pin_pheight = self.HAL_GCOMP_.newpin("probeheight", hal.Type.REAL, hal.Dir.OUT) self.pin_pheight.set(float(self.input_tool_probe_height.text())) - self.pin_bheight = self.HAL_GCOMP_.newpin("blockheight", hal.HAL_FLOAT, hal.HAL_OUT) + self.pin_bheight = self.HAL_GCOMP_.newpin("blockheight", hal.Type.REAL, hal.Dir.OUT) self.pin_bheight.set(float(self.input_tool_block_height.text())) - self.pin_latch_rtn = self.HAL_GCOMP_.newpin("backoffdist", hal.HAL_FLOAT, hal.HAL_OUT) + self.pin_latch_rtn = self.HAL_GCOMP_.newpin("backoffdist", hal.Type.REAL, hal.Dir.OUT) self.pin_latch_rtn.set(float(self.input_latch_return_dist.text())) - self.probe_loaded = self.HAL_GCOMP_.newpin("probe-loaded", hal.HAL_BIT, hal.HAL_OUT) + self.probe_loaded = self.HAL_GCOMP_.newpin("probe-loaded", hal.Type.BOOL, hal.Dir.OUT) self.HAL_GCOMP_.comp.setprefix(oldname) # install callbacks to update HAL pins diff --git a/lib/python/qtvcp/widgets/widget_baseclass.py b/lib/python/qtvcp/widgets/widget_baseclass.py index 23bfa396f45..67f048285bd 100644 --- a/lib/python/qtvcp/widgets/widget_baseclass.py +++ b/lib/python/qtvcp/widgets/widget_baseclass.py @@ -120,8 +120,8 @@ def _hal_init(self): pname = self.HAL_NAME_ else: pname = self._pin_name_ - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_BIT, hal.HAL_OUT) - self.hal_pin_not = self.HAL_GCOMP_.newpin(pname + "-not", hal.HAL_BIT, hal.HAL_OUT) + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.BOOL, hal.Dir.OUT) + self.hal_pin_not = self.HAL_GCOMP_.newpin(pname + "-not", hal.Type.BOOL, hal.Dir.OUT) self.toggled.connect(lambda data: self._pin_update(data)) def _pin_update(self, state): @@ -142,8 +142,8 @@ def _hal_init(self): pname = self.HAL_NAME_ else: pname = self._pin_name_ - self.hal_pin_f = self.HAL_GCOMP_.newpin(pname + "-f", hal.HAL_FLOAT, hal.HAL_OUT) - self.hal_pin_s = self.HAL_GCOMP_.newpin(pname + "-s", hal.HAL_S32, hal.HAL_OUT) + self.hal_pin_f = self.HAL_GCOMP_.newpin(pname + "-f", hal.Type.REAL, hal.Dir.OUT) + self.hal_pin_s = self.HAL_GCOMP_.newpin(pname + "-s", hal.Type.SINT, hal.Dir.OUT) self.valueChanged.connect(lambda data: self._pin_update(data)) # default scale self.input = 1 @@ -169,7 +169,7 @@ def _hal_init(self): pname = self.HAL_NAME_ else: pname = self._pin_name_ - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_BIT, hal.HAL_IN) + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.BOOL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda s: self.setEnabled(s)) def set_pin_name(self, value): diff --git a/lib/python/raster.py b/lib/python/raster.py index 4e87095c3bb..37676dd5756 100644 --- a/lib/python/raster.py +++ b/lib/python/raster.py @@ -54,10 +54,10 @@ def __init__(self, name): """ self.__timeout = 5.0 self.component = hal.component(name) - self.port = self.component.newpin("program", hal.HAL_PORT, hal.HAL_OUT) - self.faultCode = self.component.newpin("fault-code", hal.HAL_S32, hal.HAL_IN) - self.enabled = self.component.newpin("enabled", hal.HAL_BIT, hal.HAL_IN) - self.run = self.component.newpin("run", hal.HAL_BIT, hal.HAL_OUT) + self.port = self.component.newpin("program", hal.Type.PORT, hal.Dir.OUT) + self.faultCode = self.component.newpin("fault-code", hal.Type.SINT, hal.Dir.IN) + self.enabled = self.component.newpin("enabled", hal.Type.BOOL, hal.Dir.IN) + self.run = self.component.newpin("run", hal.Type.BOOL, hal.Dir.OUT) self.component.ready() self.run.value = False diff --git a/lib/python/vismach.py b/lib/python/vismach.py index a35f2b2ee5a..009103df62a 100644 --- a/lib/python/vismach.py +++ b/lib/python/vismach.py @@ -1558,7 +1558,7 @@ def main(model, tool, work, size=10, hud=0, rotation_vectors=None, lat=0, lon=0) t.after(100, lambda: t.set_viewangle(lat, lon, forcerotate=1)) vcomp = hal.component("vismach") - vcomp.newpin("plotclear",hal.HAL_BIT,hal.HAL_IN) + vcomp.newpin("plotclear",hal.Type.BOOL,hal.Dir.IN) vcomp.ready() #there's probably a better way of doing this diff --git a/nc_files/remap_lib/python-stdglue/stdglue.py b/nc_files/remap_lib/python-stdglue/stdglue.py index a3b93019afa..8457e400f38 100644 --- a/nc_files/remap_lib/python-stdglue/stdglue.py +++ b/nc_files/remap_lib/python-stdglue/stdglue.py @@ -33,8 +33,8 @@ def build_hal(self): import hal try: h=hal.component('remapStat') - h.newpin("tool", hal.HAL_S32, hal.HAL_OUT) - h.newpin("wear", hal.HAL_S32, hal.HAL_OUT) + h.newpin("tool", hal.Type.SINT, hal.Dir.OUT) + h.newpin("wear", hal.Type.SINT, hal.Dir.OUT) h.ready() self.hal_tool_comp = h except Exception as e: diff --git a/scripts/hal_demo b/scripts/hal_demo index 6591d65a2e5..3e27e42153b 100755 --- a/scripts/hal_demo +++ b/scripts/hal_demo @@ -136,10 +136,10 @@ if [ "$1" = "parport1" ] ; then bin/halcmd show param echo "Hit enter to create some signals" read - echo "$ bin/halcmd newsig jumper1 bit" - bin/halcmd newsig jumper1 bit - echo "$ bin/halcmd newsig jumper2 bit" - bin/halcmd newsig jumper2 bit + echo "$ bin/halcmd newsig jumper1 bool" + bin/halcmd newsig jumper1 bool + echo "$ bin/halcmd newsig jumper2 bool" + bin/halcmd newsig jumper2 bool echo "(signals created - lets look at them)" echo "$ bin/halcmd show sig" bin/halcmd show sig diff --git a/share/gscreen/skins/silverdragon/silverdragon_handler.py b/share/gscreen/skins/silverdragon/silverdragon_handler.py index 3d08239aee7..e78c1a1db8c 100644 --- a/share/gscreen/skins/silverdragon/silverdragon_handler.py +++ b/share/gscreen/skins/silverdragon/silverdragon_handler.py @@ -326,18 +326,18 @@ def init_sensitive_all_homed(self): def initialize_pins(self): # pins for block height - self.halcomp.newpin("sensor_height", hal.HAL_FLOAT, hal.HAL_OUT) - pin = self.halcomp.newpin("block_height", hal.HAL_FLOAT, hal.HAL_OUT) + self.halcomp.newpin("sensor_height", hal.Type.REAL, hal.Dir.OUT) + pin = self.halcomp.newpin("block_height", hal.Type.REAL, hal.Dir.OUT) hal_glib.GPin(pin).connect("value_changed", self.on_blockheight_changed) self.halcomp["block_height"] = self.gscreen.prefs.getpref("blockheight", 0.0, float) # pins for probing - self.halcomp.newpin("search_vel", hal.HAL_FLOAT, hal.HAL_OUT) - self.halcomp.newpin("probe_vel", hal.HAL_FLOAT, hal.HAL_OUT) - self.halcomp.newpin("maxprobe", hal.HAL_FLOAT, hal.HAL_OUT) + self.halcomp.newpin("search_vel", hal.Type.REAL, hal.Dir.OUT) + self.halcomp.newpin("probe_vel", hal.Type.REAL, hal.Dir.OUT) + self.halcomp.newpin("maxprobe", hal.Type.REAL, hal.Dir.OUT) # pins for clear_mdi button - self.halcomp.newpin("clear_mdi", hal.HAL_BIT, hal.HAL_OUT) - pin = self.halcomp.newpin("clear_mdi-waiting", hal.HAL_BIT, hal.HAL_OUT) - pin = self.halcomp.newpin("clear_mdi-response", hal.HAL_BIT, hal.HAL_OUT) + self.halcomp.newpin("clear_mdi", hal.Type.BOOL, hal.Dir.OUT) + pin = self.halcomp.newpin("clear_mdi-waiting", hal.Type.BOOL, hal.Dir.OUT) + pin = self.halcomp.newpin("clear_mdi-response", hal.Type.BOOL, hal.Dir.OUT) hal_glib.GPin(pin).connect("value_changed", self.on_clear_mdi_changed) # every 100 milli seconds this gets called diff --git a/share/gscreen/skins/spartan/spartan_handler.py b/share/gscreen/skins/spartan/spartan_handler.py index a681cbf108f..258f986308d 100644 --- a/share/gscreen/skins/spartan/spartan_handler.py +++ b/share/gscreen/skins/spartan/spartan_handler.py @@ -110,16 +110,16 @@ def initialize_pins(self): self.gscreen.init_jog_pins() self.gscreen.init_override_pins() self.gscreen.init_control_pins() - self.gscreen.halcomp.newpin("spindle-spd-disp", hal.HAL_FLOAT, hal.HAL_IN) - self.gscreen.halcomp.newpin("jog-spd-out", hal.HAL_FLOAT, hal.HAL_OUT) - self.gscreen.halcomp.newpin("jog-inc-out", hal.HAL_FLOAT, hal.HAL_OUT) - self.data['ext-estop'] = hal_glib.GPin(self.gscreen.halcomp.newpin('ext-estop', hal.HAL_BIT, hal.HAL_IN)) + self.gscreen.halcomp.newpin("spindle-spd-disp", hal.Type.REAL, hal.Dir.IN) + self.gscreen.halcomp.newpin("jog-spd-out", hal.Type.REAL, hal.Dir.OUT) + self.gscreen.halcomp.newpin("jog-inc-out", hal.Type.REAL, hal.Dir.OUT) + self.data['ext-estop'] = hal_glib.GPin(self.gscreen.halcomp.newpin('ext-estop', hal.Type.BOOL, hal.Dir.IN)) self.data['ext-estop'].connect('value-changed', self.on_estop_in) - self.data['enc-fault-x'] = hal_glib.GPin(self.gscreen.halcomp.newpin('enc-fault-x', hal.HAL_BIT, hal.HAL_IN)) + self.data['enc-fault-x'] = hal_glib.GPin(self.gscreen.halcomp.newpin('enc-fault-x', hal.Type.BOOL, hal.Dir.IN)) self.data['enc-fault-x'].connect('value-changed', self.on_x_enc_fault) - self.data['enc-fault-y'] = hal_glib.GPin(self.gscreen.halcomp.newpin('enc-fault-y', hal.HAL_BIT, hal.HAL_IN)) + self.data['enc-fault-y'] = hal_glib.GPin(self.gscreen.halcomp.newpin('enc-fault-y', hal.Type.BOOL, hal.Dir.IN)) self.data['enc-fault-y'].connect('value-changed', self.on_y_enc_fault) - self.data['enc-fault-x'] = hal_glib.GPin(self.gscreen.halcomp.newpin('enc-fault-z', hal.HAL_BIT, hal.HAL_IN)) + self.data['enc-fault-x'] = hal_glib.GPin(self.gscreen.halcomp.newpin('enc-fault-z', hal.Type.BOOL, hal.Dir.IN)) self.data['enc-fault-x'].connect('value-changed', self.on_z_enc_fault) def on_emc_off(self,*args): diff --git a/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim_handler.py b/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim_handler.py index 8e6ea7632fb..9214601d5ed 100644 --- a/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim_handler.py +++ b/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim_handler.py @@ -53,15 +53,15 @@ def initialized__(self): appPath = os.path.realpath(os.path.dirname(sys.argv[0])) self.iconBase = '/usr' if appPath == '/usr/bin' else appPath.replace('/bin', '/debian/extras/usr') self.w.setWindowIcon(QIcon(os.path.join(self.iconBase, self.iconPath))) - self.arcVoltsOffsetPin = self.hal.newpin('arc_voltage_offset-f', hal.HAL_FLOAT, hal.HAL_OUT) - self.breakPin = self.hal.newpin('sensor_breakaway', hal.HAL_BIT, hal.HAL_OUT) - self.floatPin = self.hal.newpin('sensor_float', hal.HAL_BIT, hal.HAL_OUT) - self.materialPin = self.hal.newpin('material_height', hal.HAL_FLOAT, hal.HAL_IN) - self.ohmicPin = self.hal.newpin('sensor_ohmic', hal.HAL_BIT, hal.HAL_OUT) - self.torchPin = self.hal.newpin('torch_on', hal.HAL_BIT, hal.HAL_IN) - self.statePin = self.hal.newpin('state', hal.HAL_S32, hal.HAL_IN) - self.stylePin = self.hal.newpin('style_update', hal.HAL_BIT, hal.HAL_IN) - self.zPosPin = self.hal.newpin('z_position', hal.HAL_FLOAT, hal.HAL_IN) + self.arcVoltsOffsetPin = self.hal.newpin('arc_voltage_offset-f', hal.Type.REAL, hal.Dir.OUT) + self.breakPin = self.hal.newpin('sensor_breakaway', hal.Type.BOOL, hal.Dir.OUT) + self.floatPin = self.hal.newpin('sensor_float', hal.Type.BOOL, hal.Dir.OUT) + self.materialPin = self.hal.newpin('material_height', hal.Type.REAL, hal.Dir.IN) + self.ohmicPin = self.hal.newpin('sensor_ohmic', hal.Type.BOOL, hal.Dir.OUT) + self.torchPin = self.hal.newpin('torch_on', hal.Type.BOOL, hal.Dir.IN) + self.statePin = self.hal.newpin('state', hal.Type.SINT, hal.Dir.IN) + self.stylePin = self.hal.newpin('style_update', hal.Type.BOOL, hal.Dir.IN) + self.zPosPin = self.hal.newpin('z_position', hal.Type.REAL, hal.Dir.IN) simStepconf = False for sig in hal.get_info_signals(): if sig['NAME'] == 'Zjoint-pos-fb': diff --git a/share/qtvcp/panels/test_button/test_button_handler.py b/share/qtvcp/panels/test_button/test_button_handler.py index e25ca9ce492..27098841928 100644 --- a/share/qtvcp/panels/test_button/test_button_handler.py +++ b/share/qtvcp/panels/test_button/test_button_handler.py @@ -121,8 +121,8 @@ def addButton(self): # combo box for HAL pin selection cb = HALSelectionBox() cb.setShowTypes([cb.PINS,cb.SIGNALS]) - cb.setPinTypes([cb.HAL_BIT], direction = [cb.HAL_IN]) - cb.setSignalTypes([cb.HAL_BIT], driven = [False,True]) + cb.setPinTypes([cb.HAL_BOOL], direction = [cb.HAL_IN]) + cb.setSignalTypes([cb.HAL_BOOL], driven = [False,True]) cb.hal_init() cb.objectSelected.connect(lambda w: self.selectedUpdated(w, button)) diff --git a/share/qtvcp/panels/test_dial/test_dial_handler.py b/share/qtvcp/panels/test_dial/test_dial_handler.py index 4dd967e3941..cde6d1d9906 100644 --- a/share/qtvcp/panels/test_dial/test_dial_handler.py +++ b/share/qtvcp/panels/test_dial/test_dial_handler.py @@ -56,7 +56,7 @@ def initialized__(self): cb = HALSelectionBox() cb.setShowTypes([cb.SIGNALS]) - cb.setSignalTypes([cb.HAL_FLOAT], driven = [False,True]) + cb.setSignalTypes([cb.HAL_REAL], driven = [False,True]) cb.hal_init() cb.currentTextChanged.connect(self.signalSelected) hbox.addWidget(cb) diff --git a/share/qtvcp/panels/test_led/test_led_handler.py b/share/qtvcp/panels/test_led/test_led_handler.py index bd4189018c7..a91a543d888 100644 --- a/share/qtvcp/panels/test_led/test_led_handler.py +++ b/share/qtvcp/panels/test_led/test_led_handler.py @@ -121,8 +121,8 @@ def addLED(self): # combo box for HAL pin selection cb = HALSelectionBox() cb.setShowTypes([cb.PINS,cb.SIGNALS]) - cb.setPinTypes([cb.HAL_BIT]) - cb.setSignalTypes([cb.HAL_BIT], driven = [False,True]) + cb.setPinTypes([cb.HAL_BOOL]) + cb.setSignalTypes([cb.HAL_BOOL], driven = [False,True]) cb.hal_init() cb.selectionUpdated.connect(lambda w: self.signalSelected(w,led)) diff --git a/share/qtvcp/panels/vismach_router_atc/vismach_router_atc_handler.py b/share/qtvcp/panels/vismach_router_atc/vismach_router_atc_handler.py index 20f62320160..9f5d3821b58 100644 --- a/share/qtvcp/panels/vismach_router_atc/vismach_router_atc_handler.py +++ b/share/qtvcp/panels/vismach_router_atc/vismach_router_atc_handler.py @@ -23,9 +23,9 @@ #import hal #c = hal.component("router_atc") -#c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN) -#c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -#c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) +#c.newpin("joint0", hal.Type.REAL, hal.Dir.IN) +#c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +#c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) #c.ready() diff --git a/share/qtvcp/screens/qtaxis/qtaxis_handler.py b/share/qtvcp/screens/qtaxis/qtaxis_handler.py index 0f447aca9ab..9fbea092ec9 100644 --- a/share/qtvcp/screens/qtaxis/qtaxis_handler.py +++ b/share/qtvcp/screens/qtaxis/qtaxis_handler.py @@ -399,14 +399,14 @@ def init_pins(self): # external jogging control pins for i in INFO.AVAILABLE_JOINTS: self['jog_joint_{}_pin'.format(i)] = \ - QHAL.newpin("joint-{}-selected".format(i), QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newpin("joint-{}-selected".format(i), QHAL.HAL_BOOL, QHAL.HAL_OUT) for i in INFO.AVAILABLE_AXES: self['jog_axis_{}_pin'.format(i)] = \ - QHAL.newpin("axis-{}-selected".format(i.lower()), QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newpin("axis-{}-selected".format(i.lower()), QHAL.HAL_BOOL, QHAL.HAL_OUT) # screen MPG controls - self.pin_mpg_in = QHAL.newpin('mpg-in',QHAL.HAL_S32, QHAL.HAL_IN) + self.pin_mpg_in = QHAL.newpin('mpg-in',QHAL.HAL_SINT, QHAL.HAL_IN) self.pin_mpg_in.value_changed.connect(lambda s: self.external_mpg(s)) - self.pin_mpg_enabled = QHAL.newpin('mpg-enable',QHAL.HAL_BIT, QHAL.HAL_IN) + self.pin_mpg_enabled = QHAL.newpin('mpg-enable',QHAL.HAL_BOOL, QHAL.HAL_IN) def saveSettings(self): # Record the toolbar settings diff --git a/share/qtvcp/screens/qtdragon/qtdragon_handler.py b/share/qtvcp/screens/qtdragon/qtdragon_handler.py index e6460795b0e..d69b9a00515 100644 --- a/share/qtvcp/screens/qtdragon/qtdragon_handler.py +++ b/share/qtvcp/screens/qtdragon/qtdragon_handler.py @@ -331,51 +331,51 @@ def init_utils(self): ############################# def init_pins(self): # spindle control pins - pin = QHAL.newPin("spindle-amps", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-amps", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v)) - pin = QHAL.newPin("spindle-volts", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-volts", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v)) - pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-fault", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) - pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_connection_changed(v)) - QHAL.newPin("spindle-inhibit", QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newPin("spindle-inhibit", QHAL.HAL_BOOL, QHAL.HAL_OUT) - pin = QHAL.newPin("external-pause", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("external-pause", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.btn_pause_clicked(v)) # external offset control pins - QHAL.newPin("eoffset-enable", QHAL.HAL_BIT, QHAL.HAL_OUT) - QHAL.newPin("eoffset-clear", QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newPin("eoffset-enable", QHAL.HAL_BOOL, QHAL.HAL_OUT) + QHAL.newPin("eoffset-clear", QHAL.HAL_BOOL, QHAL.HAL_OUT) self.h['eoffset-clear'] = True - QHAL.newPin("eoffset-spindle-count", QHAL.HAL_S32, QHAL.HAL_OUT) - pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BIT, QHAL.HAL_IN) + QHAL.newPin("eoffset-spindle-count", QHAL.HAL_SINT, QHAL.HAL_OUT) + pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.external_offset_state_changed(v)) # total external offset - pin = QHAL.newPin("eoffset-value", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newPin("eoffset-value", QHAL.HAL_REAL, QHAL.HAL_IN) # MPG scrolling pin - self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_S32, QHAL.HAL_IN) + self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_SINT, QHAL.HAL_IN) self.pin_mpg_in.pinValueChanged.connect(lambda p,v: self.external_mpg(v)) # dialog answer pins - pin = QHAL.newPin("dialog-ok", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("dialog-ok", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,1)) - pin = QHAL.newPin("dialog-no", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("dialog-no", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,2)) - pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,0)) def init_preferences(self): diff --git a/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py b/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py index fcba159bd4b..a8c4d45c378 100644 --- a/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py +++ b/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py @@ -260,58 +260,58 @@ def initialized__(self): ############################# def init_pins(self): # spindle control pins - pin = QHAL.newPin("spindle-amps", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-amps", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v)) - pin = QHAL.newPin("spindle-volts", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-volts", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v)) - pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-fault", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) - pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_connection_changed(v)) - QHAL.newPin("spindle-inhibit", QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newPin("spindle-inhibit", QHAL.HAL_BOOL, QHAL.HAL_OUT) - pin = QHAL.newPin("external-pause", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("external-pause", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.btn_pause_clicked(v)) # external offset control pins - QHAL.newPin("eoffset-enable", QHAL.HAL_BIT, QHAL.HAL_OUT) - QHAL.newPin("eoffset-clear", QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newPin("eoffset-enable", QHAL.HAL_BOOL, QHAL.HAL_OUT) + QHAL.newPin("eoffset-clear", QHAL.HAL_BOOL, QHAL.HAL_OUT) self.h['eoffset-clear'] = False - QHAL.newPin("eoffset-spindle-count", QHAL.HAL_S32, QHAL.HAL_OUT) - QHAL.newPin("eoffset-count", QHAL.HAL_S32, QHAL.HAL_OUT) - pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BIT, QHAL.HAL_IN) + QHAL.newPin("eoffset-spindle-count", QHAL.HAL_SINT, QHAL.HAL_OUT) + QHAL.newPin("eoffset-count", QHAL.HAL_SINT, QHAL.HAL_OUT) + pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BOOL, QHAL.HAL_IN) # total external offsets - pin = QHAL.newPin("eoffset-value", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newPin("eoffset-value", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.external_offset_state_changed(v)) - pin = QHAL.newPin("eoffset-zlevel-count", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("eoffset-zlevel-count", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.comp_count_changed(v)) - QHAL.newPin("comp-on", QHAL.HAL_BIT, QHAL.HAL_OUT) - QHAL.newPin("spindle-lift-on", QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newPin("comp-on", QHAL.HAL_BOOL, QHAL.HAL_OUT) + QHAL.newPin("spindle-lift-on", QHAL.HAL_BOOL, QHAL.HAL_OUT) # MPG scrolling pin - self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_S32, QHAL.HAL_IN) + self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_SINT, QHAL.HAL_IN) self.pin_mpg_in.pinValueChanged.connect(lambda p,v: self.external_mpg(v)) # dialog answer pins - pin = QHAL.newPin("dialog-ok", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("dialog-ok", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,1)) - pin = QHAL.newPin("dialog-no", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("dialog-no", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,2)) - pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,0)) def init_preferences(self): diff --git a/share/qtvcp/screens/qtdragon_hd_vert/qtdragon_hd_vert_handler.py b/share/qtvcp/screens/qtdragon_hd_vert/qtdragon_hd_vert_handler.py index 589c95b4959..2a3a072639b 100644 --- a/share/qtvcp/screens/qtdragon_hd_vert/qtdragon_hd_vert_handler.py +++ b/share/qtvcp/screens/qtdragon_hd_vert/qtdragon_hd_vert_handler.py @@ -260,58 +260,58 @@ def initialized__(self): ############################# def init_pins(self): # spindle control pins - pin = QHAL.newPin("spindle-amps", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-amps", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v)) - pin = QHAL.newPin("spindle-volts", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-volts", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v)) - pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-fault", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) - pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_connection_changed(v)) - QHAL.newPin("spindle-inhibit", QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newPin("spindle-inhibit", QHAL.HAL_BOOL, QHAL.HAL_OUT) - pin = QHAL.newPin("external-pause", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("external-pause", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.btn_pause_clicked(v)) # external offset control pins - QHAL.newPin("eoffset-enable", QHAL.HAL_BIT, QHAL.HAL_OUT) - QHAL.newPin("eoffset-clear", QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newPin("eoffset-enable", QHAL.HAL_BOOL, QHAL.HAL_OUT) + QHAL.newPin("eoffset-clear", QHAL.HAL_BOOL, QHAL.HAL_OUT) self.h['eoffset-clear'] = False - QHAL.newPin("eoffset-spindle-count", QHAL.HAL_S32, QHAL.HAL_OUT) - QHAL.newPin("eoffset-count", QHAL.HAL_S32, QHAL.HAL_OUT) - pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BIT, QHAL.HAL_IN) + QHAL.newPin("eoffset-spindle-count", QHAL.HAL_SINT, QHAL.HAL_OUT) + QHAL.newPin("eoffset-count", QHAL.HAL_SINT, QHAL.HAL_OUT) + pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BOOL, QHAL.HAL_IN) # total external offsets - pin = QHAL.newPin("eoffset-value", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newPin("eoffset-value", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.external_offset_state_changed(v)) - pin = QHAL.newPin("eoffset-zlevel-count", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("eoffset-zlevel-count", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.comp_count_changed(v)) - QHAL.newPin("comp-on", Qhal.HAL_BIT, Qhal.HAL_OUT) - QHAL.newPin("spindle-lift-on", Qhal.HAL_BIT, Qhal.HAL_OUT) + QHAL.newPin("comp-on", QHAL.HAL_BOOL, QHAL.HAL_OUT) + QHAL.newPin("spindle-lift-on", QHAL.HAL_BOOL, QHAL.HAL_OUT) # MPG scrolling pin - self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_S32, QHAL.HAL_IN) + self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_SINT, QHAL.HAL_IN) self.pin_mpg_in.pinValueChanged.connect(lambda p,v: self.external_mpg(v)) # dialog answer pins - pin = QHAL.newPin("dialog-ok", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("dialog-ok", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,1)) - pin = QHAL.newPin("dialog-no", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("dialog-no", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,2)) - pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,0)) def init_preferences(self): diff --git a/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py b/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py index e1a480d7ffe..e9069833b7e 100644 --- a/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py +++ b/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py @@ -321,50 +321,50 @@ def init_utils(self): ############################# def init_pins(self): # spindle control pins - pin = QHAL.newPin("spindle-amps", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-amps", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v)) - pin = QHAL.newPin("spindle-volts", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-volts", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v)) - pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-fault", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) - pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_connection_changed(v)) - QHAL.newPin("spindle-inhibit", QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newPin("spindle-inhibit", QHAL.HAL_BOOL, QHAL.HAL_OUT) - pin = QHAL.newPin("external-pause", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("external-pause", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.btn_pause_clicked(v)) # external offset control pins - QHAL.newPin("eoffset-enable", QHAL.HAL_BIT, QHAL.HAL_OUT) - QHAL.newPin("eoffset-clear", QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newPin("eoffset-enable", QHAL.HAL_BOOL, QHAL.HAL_OUT) + QHAL.newPin("eoffset-clear", QHAL.HAL_BOOL, QHAL.HAL_OUT) self.h['eoffset-clear'] = True - QHAL.newPin("eoffset-spindle-count", QHAL.HAL_S32, QHAL.HAL_OUT) - pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BIT, QHAL.HAL_IN) + QHAL.newPin("eoffset-spindle-count", QHAL.HAL_SINT, QHAL.HAL_OUT) + pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.external_offset_state_changed(v)) # total external offset - pin = QHAL.newPin("eoffset-value", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newPin("eoffset-value", QHAL.HAL_REAL, QHAL.HAL_IN) - self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_S32, QHAL.HAL_IN) + self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_SINT, QHAL.HAL_IN) self.pin_mpg_in.pinValueChanged.connect(lambda p,v: self.external_mpg(v)) # dialog answer pins - pin = QHAL.newPin("dialog-ok", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("dialog-ok", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,1)) - pin = QHAL.newPin("dialog-no", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("dialog-no", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,2)) - pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BIT, QHAL.HAL_IN) + pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,0)) def init_preferences(self): diff --git a/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py b/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py index dfdaeab8c85..dc922774bb9 100644 --- a/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py +++ b/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py @@ -839,97 +839,97 @@ def new_process_error(self, w, kind, text): ######################################################################################################################### def make_hal_pins(self): - self.consChangePin = self.h.newpin('consumable_changing', hal.HAL_BIT, hal.HAL_IN) - self.convTabDisable = self.h.newpin('conv_disable', hal.HAL_BIT, hal.HAL_IN) - self.cutTypePin = self.h.newpin('cut_type', hal.HAL_S32, hal.HAL_IN) - self.developmentPin = self.h.newpin('development', hal.HAL_BIT, hal.HAL_IN) - self.extAbortPin = self.h.newpin('ext_abort', hal.HAL_BIT, hal.HAL_IN) - self.extAutoVoltsEnablePin = self.h.newpin('ext_auto_volts_enable', hal.HAL_BIT, hal.HAL_IN) - self.extChangeConsPin = self.h.newpin('ext_consumables', hal.HAL_BIT, hal.HAL_IN) - self.extCornerLockEnablePin = self.h.newpin('ext_cornerlock_enable', hal.HAL_BIT, hal.HAL_IN) - self.extCutRecCancelPin = self.h.newpin('ext_cutrec_cancel', hal.HAL_BIT, hal.HAL_IN) - self.extCutRecRevPin = self.h.newpin('ext_cutrec_rev', hal.HAL_BIT, hal.HAL_IN) - self.extCutRecFwdPin = self.h.newpin('ext_cutrec_fwd', hal.HAL_BIT, hal.HAL_IN) - self.extCutRecNPin = self.h.newpin('ext_cutrec_n', hal.HAL_BIT, hal.HAL_IN) - self.extCutRecNEPin = self.h.newpin('ext_cutrec_ne', hal.HAL_BIT, hal.HAL_IN) - self.extCutRecEPin = self.h.newpin('ext_cutrec_e', hal.HAL_BIT, hal.HAL_IN) - self.extCutRecSEPin = self.h.newpin('ext_cutrec_se', hal.HAL_BIT, hal.HAL_IN) - self.extCutRecSPin = self.h.newpin('ext_cutrec_s', hal.HAL_BIT, hal.HAL_IN) - self.extCutRecSWPin = self.h.newpin('ext_cutrec_sw', hal.HAL_BIT, hal.HAL_IN) - self.extCutRecWPin = self.h.newpin('ext_cutrec_w', hal.HAL_BIT, hal.HAL_IN) - self.extCutRecNWPin = self.h.newpin('ext_cutrec_nw', hal.HAL_BIT, hal.HAL_IN) - self.extFramingPin = self.h.newpin('ext_frame_job', hal.HAL_BIT, hal.HAL_IN) - self.extHeightOvrCountsPin = self.h.newpin('ext_height_ovr_counts', hal.HAL_S32, hal.HAL_IN) - self.extHeightOvrCountEnablePin = self.h.newpin('ext_height_ovr_count_enable', hal.HAL_BIT, hal.HAL_IN) - self.extHeightOvrMinusPin = self.h.newpin('ext_height_ovr_minus', hal.HAL_BIT, hal.HAL_IN) - self.extHeightOvrPlusPin = self.h.newpin('ext_height_ovr_plus', hal.HAL_BIT, hal.HAL_IN) - self.extHeightOvrResetPin = self.h.newpin('ext_height_ovr_reset', hal.HAL_BIT, hal.HAL_IN) - self.extHeightOvrScalePin = self.h.newpin('ext_height_ovr_scale', hal.HAL_FLOAT, hal.HAL_IN) - self.extIgnoreArcOkPin = self.h.newpin('ext_ignore_arc_ok', hal.HAL_BIT, hal.HAL_IN) - self.extJogSlowPin = self.h.newpin('ext_jog_slow', hal.HAL_BIT, hal.HAL_IN) -# self.extKerfCrossEnablePin = self.h.newpin('ext_kerfcross_enable', hal.HAL_BIT, hal.HAL_IN) - self.extLaserTouchOffPin = self.h.newpin('ext_laser_touchoff', hal.HAL_BIT, hal.HAL_IN) - self.extLaserTogglePin = self.h.newpin('ext_laser_toggle', hal.HAL_BIT, hal.HAL_IN) - self.extMeshModePin = self.h.newpin('ext_mesh_mode', hal.HAL_BIT, hal.HAL_IN) - self.extOhmicPin = self.h.newpin('ext_ohmic', hal.HAL_BIT, hal.HAL_IN) - self.extOhmicProbeEnablePin = self.h.newpin('ext_ohmic_probe_enable', hal.HAL_BIT, hal.HAL_IN) - self.extPausePin = self.h.newpin('ext_pause', hal.HAL_BIT, hal.HAL_IN) - self.extPauseOnlyPin = self.h.newpin('ext_pause_only', hal.HAL_BIT, hal.HAL_IN) - self.extPowerPin = self.h.newpin('ext_power', hal.HAL_BIT, hal.HAL_IN) - self.extProbePin = self.h.newpin('ext_probe', hal.HAL_BIT, hal.HAL_IN) - self.extPulsePin = self.h.newpin('ext_pulse', hal.HAL_BIT, hal.HAL_IN) - self.extResumePin = self.h.newpin('ext_resume', hal.HAL_BIT, hal.HAL_IN) - self.extRunPausePin = self.h.newpin('ext_run_pause', hal.HAL_BIT, hal.HAL_IN) - self.extRunPin = self.h.newpin('ext_run', hal.HAL_BIT, hal.HAL_IN) - self.extThcEnablePin = self.h.newpin('ext_thc_enable', hal.HAL_BIT, hal.HAL_IN) - self.extTorchEnablePin = self.h.newpin('ext_torch_enable', hal.HAL_BIT, hal.HAL_IN) - self.extTouchOffPin = self.h.newpin('ext_touchoff', hal.HAL_BIT, hal.HAL_IN) - self.extVoidLockEnablePin = self.h.newpin('ext_voidlock_enable', hal.HAL_BIT, hal.HAL_IN) - self.gcodeScalePin = self.h.newpin('gcode_scale', hal.HAL_FLOAT, hal.HAL_OUT) - self.heightOverridePin = self.h.newpin('height_override', hal.HAL_FLOAT, hal.HAL_OUT) - self.jogInhibited = self.h.newpin('jog_inhibited', hal.HAL_BIT, hal.HAL_IN) - self.laserOnPin = self.h.newpin('laser_on', hal.HAL_BIT, hal.HAL_OUT) - self.offsetSetProbePin = self.h.newpin('offset_set_probe', hal.HAL_BIT, hal.HAL_OUT) - self.offsetSetScribePin = self.h.newpin('offset_set_scribe', hal.HAL_BIT, hal.HAL_OUT) - self.laserRecStatePin = self.h.newpin('laser_recovery_state', hal.HAL_S32, hal.HAL_IN) - self.materialChangePin = self.h.newpin('material_change', hal.HAL_S32, hal.HAL_IN) - self.materialChangeNumberPin = self.h.newpin('material_change_number', hal.HAL_S32, hal.HAL_IN) - self.materialChangeTimeoutPin = self.h.newpin('material_change_timeout', hal.HAL_BIT, hal.HAL_IN) - self.materialReloadPin = self.h.newpin('material_reload', hal.HAL_BIT, hal.HAL_IN) - self.materialTempPin = self.h.newpin('material_temp', hal.HAL_S32, hal.HAL_IN) - self.offsetsActivePin = self.h.newpin('offsets_active', hal.HAL_BIT, hal.HAL_IN) - self.ohmicLedInPin = self.h.newpin('ohmic_led_in', hal.HAL_BIT, hal.HAL_IN) - self.paramTabDisable = self.h.newpin('param_disable', hal.HAL_BIT, hal.HAL_IN) - self.settingsTabDisable = self.h.newpin('settings_disable', hal.HAL_BIT, hal.HAL_IN) - self.simStyleUpdate = self.h.newpin('sim_style_update', hal.HAL_BIT, hal.HAL_OUT) - self.plasmacStatePin = self.h.newpin('plasmac_state', hal.HAL_S32, hal.HAL_IN) - self.plasmacStopPin = self.h.newpin('plasmac_stop', hal.HAL_S32, hal.HAL_IN) - self.pmx485CurrentPin = self.h.newpin('pmx485_current', hal.HAL_FLOAT, hal.HAL_IN) - self.pmx485CurrentMaxPin = self.h.newpin('pmx485_current_max', hal.HAL_FLOAT, hal.HAL_IN) - self.pmx485CurrentMinPin = self.h.newpin('pmx485_current_min', hal.HAL_FLOAT, hal.HAL_IN) - self.pmx485FaultPin = self.h.newpin('pmx485_fault', hal.HAL_FLOAT, hal.HAL_IN) - self.pmx485ModePin = self.h.newpin('pmx485_mode', hal.HAL_FLOAT, hal.HAL_IN) - self.pmx485PressurePin = self.h.newpin('pmx485_pressure', hal.HAL_FLOAT, hal.HAL_IN) - self.pmx485PressureMaxPin = self.h.newpin('pmx485_pressure_max', hal.HAL_FLOAT, hal.HAL_IN) - self.pmx485PressureMinPin = self.h.newpin('pmx485_pressure_min', hal.HAL_FLOAT, hal.HAL_IN) - self.pmx485StatusPin = self.h.newpin('pmx485_status', hal.HAL_BIT, hal.HAL_IN) - self.pmx485ArcTimePin = self.h.newpin('pmx485_arc_time', hal.HAL_FLOAT, hal.HAL_IN) - self.probeTestErrorPin = self.h.newpin('probe_test_error', hal.HAL_BIT, hal.HAL_IN) - self.out0Pin = self.h.newpin('ext_out_0', hal.HAL_BIT, hal.HAL_OUT) - self.out1Pin = self.h.newpin('ext_out_1', hal.HAL_BIT, hal.HAL_OUT) - self.out2Pin = self.h.newpin('ext_out_2', hal.HAL_BIT, hal.HAL_OUT) - self.sensorActive = self.h.newpin('sensor_active', hal.HAL_BIT, hal.HAL_IN) - self.tabsAlwaysEnabled = self.h.newpin('tabs_always_enabled', hal.HAL_BIT, hal.HAL_IN) - self.thcFeedRatePin = self.h.newpin('thc_feed_rate', hal.HAL_FLOAT, hal.HAL_OUT) - self.velReduct = self.h.newpin('vel_reduct', hal.HAL_FLOAT, hal.HAL_IN) - self.xOffsetPin = self.h.newpin('x_offset', hal.HAL_FLOAT, hal.HAL_IN) - self.yOffsetPin = self.h.newpin('y_offset', hal.HAL_FLOAT, hal.HAL_IN) - self.zHeightPin = self.h.newpin('z_height', hal.HAL_FLOAT, hal.HAL_IN) - self.zOffsetPin = self.h.newpin('z_offset_counts', hal.HAL_S32, hal.HAL_IN) - self.xMinPierceExtentPin = self.h.newpin('x_min_pierce_extent', hal.HAL_FLOAT, hal.HAL_IN) - self.xMaxPierceExtentPin = self.h.newpin('x_max_pierce_extent', hal.HAL_FLOAT, hal.HAL_IN) - self.yMinPierceExtentPin = self.h.newpin('y_min_pierce_extent', hal.HAL_FLOAT, hal.HAL_IN) - self.yMaxPierceExtentPin = self.h.newpin('y_max_pierce_extent', hal.HAL_FLOAT, hal.HAL_IN) + self.consChangePin = self.h.newpin('consumable_changing', hal.Type.BOOL, hal.Dir.IN) + self.convTabDisable = self.h.newpin('conv_disable', hal.Type.BOOL, hal.Dir.IN) + self.cutTypePin = self.h.newpin('cut_type', hal.Type.SINT, hal.Dir.IN) + self.developmentPin = self.h.newpin('development', hal.Type.BOOL, hal.Dir.IN) + self.extAbortPin = self.h.newpin('ext_abort', hal.Type.BOOL, hal.Dir.IN) + self.extAutoVoltsEnablePin = self.h.newpin('ext_auto_volts_enable', hal.Type.BOOL, hal.Dir.IN) + self.extChangeConsPin = self.h.newpin('ext_consumables', hal.Type.BOOL, hal.Dir.IN) + self.extCornerLockEnablePin = self.h.newpin('ext_cornerlock_enable', hal.Type.BOOL, hal.Dir.IN) + self.extCutRecCancelPin = self.h.newpin('ext_cutrec_cancel', hal.Type.BOOL, hal.Dir.IN) + self.extCutRecRevPin = self.h.newpin('ext_cutrec_rev', hal.Type.BOOL, hal.Dir.IN) + self.extCutRecFwdPin = self.h.newpin('ext_cutrec_fwd', hal.Type.BOOL, hal.Dir.IN) + self.extCutRecNPin = self.h.newpin('ext_cutrec_n', hal.Type.BOOL, hal.Dir.IN) + self.extCutRecNEPin = self.h.newpin('ext_cutrec_ne', hal.Type.BOOL, hal.Dir.IN) + self.extCutRecEPin = self.h.newpin('ext_cutrec_e', hal.Type.BOOL, hal.Dir.IN) + self.extCutRecSEPin = self.h.newpin('ext_cutrec_se', hal.Type.BOOL, hal.Dir.IN) + self.extCutRecSPin = self.h.newpin('ext_cutrec_s', hal.Type.BOOL, hal.Dir.IN) + self.extCutRecSWPin = self.h.newpin('ext_cutrec_sw', hal.Type.BOOL, hal.Dir.IN) + self.extCutRecWPin = self.h.newpin('ext_cutrec_w', hal.Type.BOOL, hal.Dir.IN) + self.extCutRecNWPin = self.h.newpin('ext_cutrec_nw', hal.Type.BOOL, hal.Dir.IN) + self.extFramingPin = self.h.newpin('ext_frame_job', hal.Type.BOOL, hal.Dir.IN) + self.extHeightOvrCountsPin = self.h.newpin('ext_height_ovr_counts', hal.Type.SINT, hal.Dir.IN) + self.extHeightOvrCountEnablePin = self.h.newpin('ext_height_ovr_count_enable', hal.Type.BOOL, hal.Dir.IN) + self.extHeightOvrMinusPin = self.h.newpin('ext_height_ovr_minus', hal.Type.BOOL, hal.Dir.IN) + self.extHeightOvrPlusPin = self.h.newpin('ext_height_ovr_plus', hal.Type.BOOL, hal.Dir.IN) + self.extHeightOvrResetPin = self.h.newpin('ext_height_ovr_reset', hal.Type.BOOL, hal.Dir.IN) + self.extHeightOvrScalePin = self.h.newpin('ext_height_ovr_scale', hal.Type.REAL, hal.Dir.IN) + self.extIgnoreArcOkPin = self.h.newpin('ext_ignore_arc_ok', hal.Type.BOOL, hal.Dir.IN) + self.extJogSlowPin = self.h.newpin('ext_jog_slow', hal.Type.BOOL, hal.Dir.IN) +# self.extKerfCrossEnablePin = self.h.newpin('ext_kerfcross_enable', hal.Type.BOOL, hal.Dir.IN) + self.extLaserTouchOffPin = self.h.newpin('ext_laser_touchoff', hal.Type.BOOL, hal.Dir.IN) + self.extLaserTogglePin = self.h.newpin('ext_laser_toggle', hal.Type.BOOL, hal.Dir.IN) + self.extMeshModePin = self.h.newpin('ext_mesh_mode', hal.Type.BOOL, hal.Dir.IN) + self.extOhmicPin = self.h.newpin('ext_ohmic', hal.Type.BOOL, hal.Dir.IN) + self.extOhmicProbeEnablePin = self.h.newpin('ext_ohmic_probe_enable', hal.Type.BOOL, hal.Dir.IN) + self.extPausePin = self.h.newpin('ext_pause', hal.Type.BOOL, hal.Dir.IN) + self.extPauseOnlyPin = self.h.newpin('ext_pause_only', hal.Type.BOOL, hal.Dir.IN) + self.extPowerPin = self.h.newpin('ext_power', hal.Type.BOOL, hal.Dir.IN) + self.extProbePin = self.h.newpin('ext_probe', hal.Type.BOOL, hal.Dir.IN) + self.extPulsePin = self.h.newpin('ext_pulse', hal.Type.BOOL, hal.Dir.IN) + self.extResumePin = self.h.newpin('ext_resume', hal.Type.BOOL, hal.Dir.IN) + self.extRunPausePin = self.h.newpin('ext_run_pause', hal.Type.BOOL, hal.Dir.IN) + self.extRunPin = self.h.newpin('ext_run', hal.Type.BOOL, hal.Dir.IN) + self.extThcEnablePin = self.h.newpin('ext_thc_enable', hal.Type.BOOL, hal.Dir.IN) + self.extTorchEnablePin = self.h.newpin('ext_torch_enable', hal.Type.BOOL, hal.Dir.IN) + self.extTouchOffPin = self.h.newpin('ext_touchoff', hal.Type.BOOL, hal.Dir.IN) + self.extVoidLockEnablePin = self.h.newpin('ext_voidlock_enable', hal.Type.BOOL, hal.Dir.IN) + self.gcodeScalePin = self.h.newpin('gcode_scale', hal.Type.REAL, hal.Dir.OUT) + self.heightOverridePin = self.h.newpin('height_override', hal.Type.REAL, hal.Dir.OUT) + self.jogInhibited = self.h.newpin('jog_inhibited', hal.Type.BOOL, hal.Dir.IN) + self.laserOnPin = self.h.newpin('laser_on', hal.Type.BOOL, hal.Dir.OUT) + self.offsetSetProbePin = self.h.newpin('offset_set_probe', hal.Type.BOOL, hal.Dir.OUT) + self.offsetSetScribePin = self.h.newpin('offset_set_scribe', hal.Type.BOOL, hal.Dir.OUT) + self.laserRecStatePin = self.h.newpin('laser_recovery_state', hal.Type.SINT, hal.Dir.IN) + self.materialChangePin = self.h.newpin('material_change', hal.Type.SINT, hal.Dir.IN) + self.materialChangeNumberPin = self.h.newpin('material_change_number', hal.Type.SINT, hal.Dir.IN) + self.materialChangeTimeoutPin = self.h.newpin('material_change_timeout', hal.Type.BOOL, hal.Dir.IN) + self.materialReloadPin = self.h.newpin('material_reload', hal.Type.BOOL, hal.Dir.IN) + self.materialTempPin = self.h.newpin('material_temp', hal.Type.SINT, hal.Dir.IN) + self.offsetsActivePin = self.h.newpin('offsets_active', hal.Type.BOOL, hal.Dir.IN) + self.ohmicLedInPin = self.h.newpin('ohmic_led_in', hal.Type.BOOL, hal.Dir.IN) + self.paramTabDisable = self.h.newpin('param_disable', hal.Type.BOOL, hal.Dir.IN) + self.settingsTabDisable = self.h.newpin('settings_disable', hal.Type.BOOL, hal.Dir.IN) + self.simStyleUpdate = self.h.newpin('sim_style_update', hal.Type.BOOL, hal.Dir.OUT) + self.plasmacStatePin = self.h.newpin('plasmac_state', hal.Type.SINT, hal.Dir.IN) + self.plasmacStopPin = self.h.newpin('plasmac_stop', hal.Type.SINT, hal.Dir.IN) + self.pmx485CurrentPin = self.h.newpin('pmx485_current', hal.Type.REAL, hal.Dir.IN) + self.pmx485CurrentMaxPin = self.h.newpin('pmx485_current_max', hal.Type.REAL, hal.Dir.IN) + self.pmx485CurrentMinPin = self.h.newpin('pmx485_current_min', hal.Type.REAL, hal.Dir.IN) + self.pmx485FaultPin = self.h.newpin('pmx485_fault', hal.Type.REAL, hal.Dir.IN) + self.pmx485ModePin = self.h.newpin('pmx485_mode', hal.Type.REAL, hal.Dir.IN) + self.pmx485PressurePin = self.h.newpin('pmx485_pressure', hal.Type.REAL, hal.Dir.IN) + self.pmx485PressureMaxPin = self.h.newpin('pmx485_pressure_max', hal.Type.REAL, hal.Dir.IN) + self.pmx485PressureMinPin = self.h.newpin('pmx485_pressure_min', hal.Type.REAL, hal.Dir.IN) + self.pmx485StatusPin = self.h.newpin('pmx485_status', hal.Type.BOOL, hal.Dir.IN) + self.pmx485ArcTimePin = self.h.newpin('pmx485_arc_time', hal.Type.REAL, hal.Dir.IN) + self.probeTestErrorPin = self.h.newpin('probe_test_error', hal.Type.BOOL, hal.Dir.IN) + self.out0Pin = self.h.newpin('ext_out_0', hal.Type.BOOL, hal.Dir.OUT) + self.out1Pin = self.h.newpin('ext_out_1', hal.Type.BOOL, hal.Dir.OUT) + self.out2Pin = self.h.newpin('ext_out_2', hal.Type.BOOL, hal.Dir.OUT) + self.sensorActive = self.h.newpin('sensor_active', hal.Type.BOOL, hal.Dir.IN) + self.tabsAlwaysEnabled = self.h.newpin('tabs_always_enabled', hal.Type.BOOL, hal.Dir.IN) + self.thcFeedRatePin = self.h.newpin('thc_feed_rate', hal.Type.REAL, hal.Dir.OUT) + self.velReduct = self.h.newpin('vel_reduct', hal.Type.REAL, hal.Dir.IN) + self.xOffsetPin = self.h.newpin('x_offset', hal.Type.REAL, hal.Dir.IN) + self.yOffsetPin = self.h.newpin('y_offset', hal.Type.REAL, hal.Dir.IN) + self.zHeightPin = self.h.newpin('z_height', hal.Type.REAL, hal.Dir.IN) + self.zOffsetPin = self.h.newpin('z_offset_counts', hal.Type.SINT, hal.Dir.IN) + self.xMinPierceExtentPin = self.h.newpin('x_min_pierce_extent', hal.Type.REAL, hal.Dir.IN) + self.xMaxPierceExtentPin = self.h.newpin('x_max_pierce_extent', hal.Type.REAL, hal.Dir.IN) + self.yMinPierceExtentPin = self.h.newpin('y_min_pierce_extent', hal.Type.REAL, hal.Dir.IN) + self.yMaxPierceExtentPin = self.h.newpin('y_max_pierce_extent', hal.Type.REAL, hal.Dir.IN) def link_hal_pins(self): # arc parameters @@ -5656,10 +5656,10 @@ def pmx485_setup(self): 'cut_mode-f', 'pmx485_mode', 'cut_amps-f', 'pmx485_current', 'pmx485_current_min', 'pmx485_current_max', 'gas_pressure-f', 'pmx485_pressure', 'pmx485_pressure_min', 'pmx485_pressure_max', 'pmx485_arc_time'] - pinType = [hal.HAL_BIT, hal.HAL_BIT, hal.HAL_FLOAT, - hal.HAL_FLOAT, hal.HAL_FLOAT, - hal.HAL_FLOAT, hal.HAL_FLOAT, hal.HAL_FLOAT, hal.HAL_FLOAT, - hal.HAL_FLOAT, hal.HAL_FLOAT, hal.HAL_FLOAT, hal.HAL_FLOAT, hal.HAL_FLOAT] + pinType = [hal.Type.BOOL, hal.Type.BOOL, hal.Type.REAL, + hal.Type.REAL, hal.Type.REAL, + hal.Type.REAL, hal.Type.REAL, hal.Type.REAL, hal.Type.REAL, + hal.Type.REAL, hal.Type.REAL, hal.Type.REAL, hal.Type.REAL, hal.Type.REAL] for pin in self.pins485Comp: hal.new_sig(f'plasmac:{pin.replace("pmx485.", "pmx485_")}', pinType[self.pins485Comp.index(pin)]) hal.connect(pin, f'plasmac:{pin.replace("pmx485.", "pmx485_")}') diff --git a/share/qtvcp/screens/qttouchy/qttouchy_handler.py b/share/qtvcp/screens/qttouchy/qttouchy_handler.py index e52e74a08f3..69a66c97f37 100644 --- a/share/qtvcp/screens/qttouchy/qttouchy_handler.py +++ b/share/qtvcp/screens/qttouchy/qttouchy_handler.py @@ -57,20 +57,20 @@ def __init__(self, halcomp,widgets,paths): def initialized__(self): KEYBIND.add_call('Key_F12','on_keycall_F12') - self.pin_mpg_in = QHAL.newpin('mpg-in',QHAL.HAL_S32, QHAL.HAL_IN) + self.pin_mpg_in = QHAL.newpin('mpg-in',QHAL.HAL_SINT, QHAL.HAL_IN) self.pin_mpg_in.value_changed.connect(lambda s: self.external_mpg(s)) - self.pin_cycle_start_in = QHAL.newpin('cycle-start-in',QHAL.HAL_BIT, QHAL.HAL_IN) + self.pin_cycle_start_in = QHAL.newpin('cycle-start-in',QHAL.HAL_BOOL, QHAL.HAL_IN) self.pin_cycle_start_in.value_changed.connect(lambda s: self.cycleStart(s)) - self.pin_abort = QHAL.newpin('abort',QHAL.HAL_BIT, QHAL.HAL_IN) + self.pin_abort = QHAL.newpin('abort',QHAL.HAL_BOOL, QHAL.HAL_IN) self.pin_abort.value_changed.connect(lambda s: self.abort(s)) - self.wheel_x = QHAL.newpin('jogwheel.x-enable',QHAL.HAL_BIT, QHAL.HAL_OUT) - self.wheel_y = QHAL.newpin('jogwheel.y-enable',QHAL.HAL_BIT, QHAL.HAL_OUT) - self.wheel_z = QHAL.newpin('jogwheel.z-enable',QHAL.HAL_BIT, QHAL.HAL_OUT) + self.wheel_x = QHAL.newpin('jogwheel.x-enable',QHAL.HAL_BOOL, QHAL.HAL_OUT) + self.wheel_y = QHAL.newpin('jogwheel.y-enable',QHAL.HAL_BOOL, QHAL.HAL_OUT) + self.wheel_z = QHAL.newpin('jogwheel.z-enable',QHAL.HAL_BOOL, QHAL.HAL_OUT) - self.jog_increment = QHAL.newpin('jogwheel.increment',QHAL.HAL_FLOAT, QHAL.HAL_OUT) + self.jog_increment = QHAL.newpin('jogwheel.increment',QHAL.HAL_REAL, QHAL.HAL_OUT) STATUS.connect('feed-override-changed', lambda w, data: self.w.pushbutton_fo.setText('FO {0:.0f}%'.format(data))) STATUS.connect('rapid-override-changed', lambda w, data: self.w.pushbutton_ro.setText('RO {0:.0f}%'.format(data))) diff --git a/share/qtvcp/screens/woodpecker/woodpecker_handler.py b/share/qtvcp/screens/woodpecker/woodpecker_handler.py index c1c9126ab70..7b254d3727c 100644 --- a/share/qtvcp/screens/woodpecker/woodpecker_handler.py +++ b/share/qtvcp/screens/woodpecker/woodpecker_handler.py @@ -246,28 +246,28 @@ def init_utils(self): ############################# def init_pins(self): # spindle control pins - pin = QHAL.newpin("spindle-amps", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-amps", QHAL.HAL_REAL, QHAL.HAL_IN) pin.value_changed.connect(self.spindle_pwr_changed) - pin = QHAL.newpin("spindle-volts", QHAL.HAL_FLOAT, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-volts", QHAL.HAL_REAL, QHAL.HAL_IN) pin.value_changed.connect(self.spindle_pwr_changed) - pin = QHAL.newpin("spindle-fault", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-fault", QHAL.HAL_UINT, QHAL.HAL_IN) pin.value_changed.connect(self.spindle_fault_changed) - pin = QHAL.newpin("spindle-modbus-errors", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-modbus-errors", QHAL.HAL_UINT, QHAL.HAL_IN) pin.value_changed.connect(self.mb_errors_changed) - QHAL.newpin("spindle-inhibit", QHAL.HAL_BIT, QHAL.HAL_OUT) + QHAL.newpin("spindle-inhibit", QHAL.HAL_BOOL, QHAL.HAL_OUT) # external offset control pins - QHAL.newpin("eoffset-enable", QHAL.HAL_BIT, QHAL.HAL_OUT) - QHAL.newpin("eoffset-clear", QHAL.HAL_BIT, QHAL.HAL_OUT) - QHAL.newpin("eoffset-count", QHAL.HAL_S32, QHAL.HAL_OUT) - pin = QHAL.newpin("eoffset-value", QHAL.HAL_FLOAT, QHAL.HAL_IN) + QHAL.newpin("eoffset-enable", QHAL.HAL_BOOL, QHAL.HAL_OUT) + QHAL.newpin("eoffset-clear", QHAL.HAL_BOOL, QHAL.HAL_OUT) + QHAL.newpin("eoffset-count", QHAL.HAL_SINT, QHAL.HAL_OUT) + pin = QHAL.newpin("eoffset-value", QHAL.HAL_REAL, QHAL.HAL_IN) - self.pin_mpg_in = self.h.newpin('mpg-in',hal.HAL_S32, hal.HAL_IN) + self.pin_mpg_in = self.h.newpin('mpg-in',hal.Type.SINT, hal.Dir.IN) self.pin_mpg_in.value_changed.connect(lambda s: self.external_mpg(s)) - self.wheel_x = self.h.newpin('jog.wheel.x',hal.HAL_BIT, hal.HAL_OUT) - self.wheel_y = self.h.newpin('jog.wheel.y',hal.HAL_BIT, hal.HAL_OUT) - self.wheel_z = self.h.newpin('jog.wheel.z',hal.HAL_BIT, hal.HAL_OUT) - self.wheel_a = self.h.newpin('jog.wheel.a',hal.HAL_BIT, hal.HAL_OUT) - self.jog_increment = self.h.newpin('jog.wheel.increment',hal.HAL_FLOAT, hal.HAL_OUT) + self.wheel_x = self.h.newpin('jog.wheel.x',hal.Type.BOOL, hal.Dir.OUT) + self.wheel_y = self.h.newpin('jog.wheel.y',hal.Type.BOOL, hal.Dir.OUT) + self.wheel_z = self.h.newpin('jog.wheel.z',hal.Type.BOOL, hal.Dir.OUT) + self.wheel_a = self.h.newpin('jog.wheel.a',hal.Type.BOOL, hal.Dir.OUT) + self.jog_increment = self.h.newpin('jog.wheel.increment',hal.Type.REAL, hal.Dir.OUT) def init_preferences(self): if not self.w.PREFS_: diff --git a/src/Makefile b/src/Makefile index 2c56a18ed3a..d6545133cc9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -553,7 +553,7 @@ genclean: -rm -f ../lib/*.so.[0-9]* -rm -f $(GENERATED_MANPAGES) -rm -f ../rtlib/*.$(MODULE_EXT) - -rm -f hal/components/conv_*.comp + -rm -f $(patsubst %,hal/components/%,$(notdir $(CONVERTERS))) pycheck-python-files: @echo 'Checking *.py files for python3 compatibility...' diff --git a/src/emc/motion/motion.c b/src/emc/motion/motion.c index d2cb7615958..fae9de1fa57 100644 --- a/src/emc/motion/motion.c +++ b/src/emc/motion/motion.c @@ -1014,7 +1014,7 @@ static int init_threads(void) /* create HAL threads for each period */ /* only create base thread if it is faster than servo thread */ if (servo_base_ratio > 1) { - retval = hal_create_thread("base-thread", base_period_nsec, base_thread_fp); + retval = hal_create_thread("base-thread", base_period_nsec); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "MOTION: failed to create %ld nsec base thread\n", @@ -1022,7 +1022,7 @@ static int init_threads(void) return -1; } } - retval = hal_create_thread("servo-thread", servo_period_nsec, 1); + retval = hal_create_thread("servo-thread", servo_period_nsec); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "MOTION: failed to create %ld nsec servo thread\n", @@ -1031,14 +1031,14 @@ static int init_threads(void) } /* export realtime functions that do the real work */ retval = hal_export_funct("motion-controller", emcmotController, 0 /* arg - */ , 1 /* uses_fp */ , 0 /* reentrant */ , mot_comp_id); + */ , 0 /* reentrant */ , mot_comp_id); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "MOTION: failed to export controller function\n"); return -1; } retval = hal_export_funct("motion-command-handler", emcmotCommandHandler, 0 /* arg - */ , 1 /* uses_fp */ , 0 /* reentrant */ , mot_comp_id); + */ , 0 /* reentrant */ , mot_comp_id); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "MOTION: failed to export command handler function\n"); diff --git a/src/emc/rs274ngc/interp_namedparams.cc b/src/emc/rs274ngc/interp_namedparams.cc index d0f2d4b8b63..a5c3a3a6913 100644 --- a/src/emc/rs274ngc/interp_namedparams.cc +++ b/src/emc/rs274ngc/interp_namedparams.cc @@ -326,8 +326,6 @@ int Interp::fetch_hal_param( const char *nameBuf, int *status, double *value) assign: switch (type) { case HAL_BOOL: *value = (double)qval.b; break; - case HAL_U32: *value = (double)qval.u; break; - case HAL_S32: *value = (double)qval.s; break; case HAL_UINT: *value = (double)qval.u; break; case HAL_SINT: *value = (double)qval.s; break; case HAL_REAL: *value = (double)qval.r; break; diff --git a/src/emc/usr_intf/axis/scripts/axis.py b/src/emc/usr_intf/axis/scripts/axis.py index f9f04cc72a5..350e1dab87d 100755 --- a/src/emc/usr_intf/axis/scripts/axis.py +++ b/src/emc/usr_intf/axis/scripts/axis.py @@ -3942,22 +3942,22 @@ def select_run_from(e): if hal_present == 1 : comp = hal.component("axisui") - comp.newpin("jog.x", hal.HAL_BIT, hal.HAL_OUT) - comp.newpin("jog.y", hal.HAL_BIT, hal.HAL_OUT) - comp.newpin("jog.z", hal.HAL_BIT, hal.HAL_OUT) - comp.newpin("jog.a", hal.HAL_BIT, hal.HAL_OUT) - comp.newpin("jog.b", hal.HAL_BIT, hal.HAL_OUT) - comp.newpin("jog.c", hal.HAL_BIT, hal.HAL_OUT) - comp.newpin("jog.u", hal.HAL_BIT, hal.HAL_OUT) - comp.newpin("jog.v", hal.HAL_BIT, hal.HAL_OUT) - comp.newpin("jog.w", hal.HAL_BIT, hal.HAL_OUT) - comp.newpin("jog.increment", hal.HAL_FLOAT, hal.HAL_OUT) - comp.newpin("notifications-clear",hal.HAL_BIT,hal.HAL_IN) - comp.newpin("notifications-clear-info",hal.HAL_BIT,hal.HAL_IN) - comp.newpin("notifications-clear-error",hal.HAL_BIT,hal.HAL_IN) - comp.newpin("resume-inhibit",hal.HAL_BIT,hal.HAL_IN) - comp.newpin("error", hal.HAL_BIT, hal.HAL_OUT) - comp.newpin("abort", hal.HAL_BIT, hal.HAL_OUT) + comp.newpin("jog.x", hal.Type.BOOL, hal.Dir.OUT) + comp.newpin("jog.y", hal.Type.BOOL, hal.Dir.OUT) + comp.newpin("jog.z", hal.Type.BOOL, hal.Dir.OUT) + comp.newpin("jog.a", hal.Type.BOOL, hal.Dir.OUT) + comp.newpin("jog.b", hal.Type.BOOL, hal.Dir.OUT) + comp.newpin("jog.c", hal.Type.BOOL, hal.Dir.OUT) + comp.newpin("jog.u", hal.Type.BOOL, hal.Dir.OUT) + comp.newpin("jog.v", hal.Type.BOOL, hal.Dir.OUT) + comp.newpin("jog.w", hal.Type.BOOL, hal.Dir.OUT) + comp.newpin("jog.increment", hal.Type.REAL, hal.Dir.OUT) + comp.newpin("notifications-clear",hal.Type.BOOL,hal.Dir.IN) + comp.newpin("notifications-clear-info",hal.Type.BOOL,hal.Dir.IN) + comp.newpin("notifications-clear-error",hal.Type.BOOL,hal.Dir.IN) + comp.newpin("resume-inhibit",hal.Type.BOOL,hal.Dir.IN) + comp.newpin("error", hal.Type.BOOL, hal.Dir.OUT) + comp.newpin("abort", hal.Type.BOOL, hal.Dir.OUT) vars.has_ladder.set(hal.component_exists('classicladder_rt')) diff --git a/src/emc/usr_intf/axis/scripts/hal_manualtoolchange.py b/src/emc/usr_intf/axis/scripts/hal_manualtoolchange.py index 6308fb73865..65ec28150ec 100644 --- a/src/emc/usr_intf/axis/scripts/hal_manualtoolchange.py +++ b/src/emc/usr_intf/axis/scripts/hal_manualtoolchange.py @@ -78,10 +78,10 @@ def get_tool_change_message(n): h = hal.component("hal_manualtoolchange") -h.newpin("number", hal.HAL_S32, hal.HAL_IN) -h.newpin("change", hal.HAL_BIT, hal.HAL_IN) -h.newpin("change_button", hal.HAL_BIT, hal.HAL_IN) -h.newpin("changed", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("number", hal.Type.SINT, hal.Dir.IN) +h.newpin("change", hal.Type.BOOL, hal.Dir.IN) +h.newpin("change_button", hal.Type.BOOL, hal.Dir.IN) +h.newpin("changed", hal.Type.BOOL, hal.Dir.OUT) h.ready() import nf, rs274.options diff --git a/src/emc/usr_intf/axis/scripts/haltest.py b/src/emc/usr_intf/axis/scripts/haltest.py deleted file mode 100644 index 4d64f3e229f..00000000000 --- a/src/emc/usr_intf/axis/scripts/haltest.py +++ /dev/null @@ -1,10 +0,0 @@ -from hal import *; import time -h = component("test"); -h.newpin("i", HAL_S32, HAL_OUT); -h.newpin("f", HAL_FLOAT, HAL_OUT); -h.newpin("u32", HAL_U32, HAL_OUT); -while 1: - h.i += 1; - h.f = h.i * .3125 - h.u32 = (7*h.i) % 256 - time.sleep(.1) diff --git a/src/emc/usr_intf/axis/scripts/tracking-test.py b/src/emc/usr_intf/axis/scripts/tracking-test.py index 0fbc7695a80..d7e0d2244a5 100755 --- a/src/emc/usr_intf/axis/scripts/tracking-test.py +++ b/src/emc/usr_intf/axis/scripts/tracking-test.py @@ -15,18 +15,18 @@ compname = "tracking-test" c = hal.component(compname) #declare hal pins here -c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis0", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis4", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis5", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint0", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint3", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint4", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint5", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis0", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis1", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis2", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis3", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis4", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis5", hal.Type.REAL, hal.Dir.IN) c.ready() diff --git a/src/emc/usr_intf/gmoccapy/gmoccapy.py b/src/emc/usr_intf/gmoccapy/gmoccapy.py index f468e9ca8a9..d6e9bb4f11c 100644 --- a/src/emc/usr_intf/gmoccapy/gmoccapy.py +++ b/src/emc/usr_intf/gmoccapy/gmoccapy.py @@ -2640,20 +2640,20 @@ def _init_user_messages(self): return for message in user_messages: if message[1] == "status": - pin = hal_glib.GPin(self.halcomp.newpin("messages." + message[2], hal.HAL_BIT, hal.HAL_IN)) + pin = hal_glib.GPin(self.halcomp.newpin("messages." + message[2], hal.Type.BOOL, hal.Dir.IN)) pin.connect("value_changed", self._show_user_message, message) elif message[1] == "okdialog": - pin = hal_glib.GPin(self.halcomp.newpin("messages." + message[2], hal.HAL_BIT, hal.HAL_IN)) + pin = hal_glib.GPin(self.halcomp.newpin("messages." + message[2], hal.Type.BOOL, hal.Dir.IN)) pin.connect("value_changed", self._show_user_message, message) pin = hal_glib.GPin( - self.halcomp.newpin("messages." + message[2] + "-waiting", hal.HAL_BIT, hal.HAL_OUT)) + self.halcomp.newpin("messages." + message[2] + "-waiting", hal.Type.BOOL, hal.Dir.OUT)) elif message[1] == "yesnodialog": - pin = hal_glib.GPin(self.halcomp.newpin("messages." + message[2], hal.HAL_BIT, hal.HAL_IN)) + pin = hal_glib.GPin(self.halcomp.newpin("messages." + message[2], hal.Type.BOOL, hal.Dir.IN)) pin.connect("value_changed", self._show_user_message, message) pin = hal_glib.GPin( - self.halcomp.newpin("messages." + message[2] + "-waiting", hal.HAL_BIT, hal.HAL_OUT)) + self.halcomp.newpin("messages." + message[2] + "-waiting", hal.Type.BOOL, hal.Dir.OUT)) pin = hal_glib.GPin( - self.halcomp.newpin("messages." + message[2] + "-response", hal.HAL_BIT, hal.HAL_OUT)) + self.halcomp.newpin("messages." + message[2] + "-response", hal.Type.BOOL, hal.Dir.OUT)) else: LOG.error(_("Message type {0} not supported").format(message[1])) @@ -6399,135 +6399,135 @@ def _get_child_button(self, location, number = None): def _make_hal_pins(self): # generate the horizontal button pins for h_button in range(0, 10): - pin = self.halcomp.newpin("h-button.button-{0}".format(h_button), hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("h-button.button-{0}".format(h_button), hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._button_pin_changed) # generate the vertical button pins for v_button in range(0, 7): - pin = self.halcomp.newpin("v-button.button-{0}".format(v_button), hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("v-button.button-{0}".format(v_button), hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._button_pin_changed) # buttons for jogging the axis for jog_button in self.axis_list: - pin = self.halcomp.newpin("jog.axis.jog-{0}-plus".format(jog_button), hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("jog.axis.jog-{0}-plus".format(jog_button), hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_pin_jog_changed, "{0}+".format(jog_button)) - pin = self.halcomp.newpin("jog.axis.jog-{0}-minus".format(jog_button), hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("jog.axis.jog-{0}-minus".format(jog_button), hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_pin_jog_changed, "{0}-".format(jog_button)) if self.stat.kinematics_type != linuxcnc.KINEMATICS_IDENTITY: for joint_button in range(0, self.stat.joints): - pin = self.halcomp.newpin("jog.joint.jog-{0}-plus".format(joint_button), hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("jog.joint.jog-{0}-plus".format(joint_button), hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_pin_jog_changed, "{0}+".format(joint_button)) - pin = self.halcomp.newpin("jog.joint.jog-{0}-minus".format(joint_button), hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("jog.joint.jog-{0}-minus".format(joint_button), hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_pin_jog_changed, "{0}+".format(joint_button)) # jog_increment out pin - self.halcomp.newpin("jog.jog-increment", hal.HAL_FLOAT, hal.HAL_OUT) + self.halcomp.newpin("jog.jog-increment", hal.Type.REAL, hal.Dir.OUT) # generate the pins to set the increments for buttonnumber in range(0, len(self.jog_increments)): - pin = self.halcomp.newpin("jog.jog-inc-{0}".format(buttonnumber), hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("jog.jog-inc-{0}".format(buttonnumber), hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_pin_incr_changed, buttonnumber) # make the pin for unlocking settings page - pin = self.halcomp.newpin("unlock-settings", hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("unlock-settings", hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_unlock_settings_changed) # generate the pins to connect encoders to the sliders - pin = self.halcomp.newpin("feed.feed-override.counts", hal.HAL_S32, hal.HAL_IN) + pin = self.halcomp.newpin("feed.feed-override.counts", hal.Type.SINT, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_counts_changed, "spc_feed") - pin = self.halcomp.newpin("spindle.spindle-override.counts", hal.HAL_S32, hal.HAL_IN) + pin = self.halcomp.newpin("spindle.spindle-override.counts", hal.Type.SINT, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_counts_changed, "spc_spindle") - pin = self.halcomp.newpin("jog.jog-velocity.counts", hal.HAL_S32, hal.HAL_IN) + pin = self.halcomp.newpin("jog.jog-velocity.counts", hal.Type.SINT, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_counts_changed, "spc_lin_jog_vel") - pin = self.halcomp.newpin("rapid.rapid-override.counts", hal.HAL_S32, hal.HAL_IN) + pin = self.halcomp.newpin("rapid.rapid-override.counts", hal.Type.SINT, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_counts_changed, "spc_rapid") - self.halcomp.newpin("feed.feed-override.count-enable", hal.HAL_BIT, hal.HAL_IN) - self.halcomp.newpin("spindle.spindle-override.count-enable", hal.HAL_BIT, hal.HAL_IN) - self.halcomp.newpin("jog.jog-velocity.count-enable", hal.HAL_BIT, hal.HAL_IN) - self.halcomp.newpin("rapid.rapid-override.count-enable", hal.HAL_BIT, hal.HAL_IN) + self.halcomp.newpin("feed.feed-override.count-enable", hal.Type.BOOL, hal.Dir.IN) + self.halcomp.newpin("spindle.spindle-override.count-enable", hal.Type.BOOL, hal.Dir.IN) + self.halcomp.newpin("jog.jog-velocity.count-enable", hal.Type.BOOL, hal.Dir.IN) + self.halcomp.newpin("rapid.rapid-override.count-enable", hal.Type.BOOL, hal.Dir.IN) # generate the pins to connect analog inputs for sliders - pin = self.halcomp.newpin("feed.feed-override.analog-enable", hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("feed.feed-override.analog-enable", hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_analog_enable_changed, "spc_feed") - pin = self.halcomp.newpin("spindle.spindle-override.analog-enable", hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("spindle.spindle-override.analog-enable", hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_analog_enable_changed, "spc_spindle") - pin = self.halcomp.newpin("jog.jog-velocity.analog-enable", hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("jog.jog-velocity.analog-enable", hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_analog_enable_changed, "spc_lin_jog_vel") - pin = self.halcomp.newpin("rapid.rapid-override.analog-enable", hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("rapid.rapid-override.analog-enable", hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_analog_enable_changed, "spc_rapid") - pin = self.halcomp.newpin("feed.feed-override.direct-value", hal.HAL_FLOAT, hal.HAL_IN) + pin = self.halcomp.newpin("feed.feed-override.direct-value", hal.Type.REAL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_analog_value_changed, "spc_feed") - pin = self.halcomp.newpin("spindle.spindle-override.direct-value", hal.HAL_FLOAT, hal.HAL_IN) + pin = self.halcomp.newpin("spindle.spindle-override.direct-value", hal.Type.REAL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_analog_value_changed, "spc_spindle") - pin = self.halcomp.newpin("jog.jog-velocity.direct-value", hal.HAL_FLOAT, hal.HAL_IN) + pin = self.halcomp.newpin("jog.jog-velocity.direct-value", hal.Type.REAL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_analog_value_changed, "spc_lin_jog_vel") - pin = self.halcomp.newpin("rapid.rapid-override.direct-value", hal.HAL_FLOAT, hal.HAL_IN) + pin = self.halcomp.newpin("rapid.rapid-override.direct-value", hal.Type.REAL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_analog_value_changed, "spc_rapid") # make a pin to set turtle jog vel - pin = self.halcomp.newpin("jog.turtle-jog", hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("jog.turtle-jog", hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_pin_turtle_jog) # make the pins for tool measurement - self.halcomp.newpin("probeheight", hal.HAL_FLOAT, hal.HAL_OUT) - pin = self.halcomp.newpin("blockheight", hal.HAL_FLOAT, hal.HAL_OUT) + self.halcomp.newpin("probeheight", hal.Type.REAL, hal.Dir.OUT) + pin = self.halcomp.newpin("blockheight", hal.Type.REAL, hal.Dir.OUT) hal_glib.GPin(pin).connect("value_changed", self._on_blockheight_value_changed) preset = self.prefs.getpref("blockheight", 0.0, float) self.halcomp["blockheight"] = preset - self.halcomp.newpin("toolmeasurement", hal.HAL_BIT, hal.HAL_OUT) - self.halcomp.newpin("searchvel", hal.HAL_FLOAT, hal.HAL_OUT) - self.halcomp.newpin("probevel", hal.HAL_FLOAT, hal.HAL_OUT) + self.halcomp.newpin("toolmeasurement", hal.Type.BOOL, hal.Dir.OUT) + self.halcomp.newpin("searchvel", hal.Type.REAL, hal.Dir.OUT) + self.halcomp.newpin("probevel", hal.Type.REAL, hal.Dir.OUT) # make pins to react to tool_offset changes - pin = self.halcomp.newpin("tooloffset-x", hal.HAL_FLOAT, hal.HAL_IN) + pin = self.halcomp.newpin("tooloffset-x", hal.Type.REAL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._offset_changed, "tooloffset-x") - pin = self.halcomp.newpin("tooloffset-z", hal.HAL_FLOAT, hal.HAL_IN) + pin = self.halcomp.newpin("tooloffset-z", hal.Type.REAL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._offset_changed, "tooloffset-z") - self.halcomp.newpin("tool-diameter", hal.HAL_FLOAT, hal.HAL_OUT) + self.halcomp.newpin("tool-diameter", hal.Type.REAL, hal.Dir.OUT) # make a pin to delete a notification message - pin = self.halcomp.newpin("delete-message", hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("delete-message", hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._del_message_changed) # for manual tool change dialog - self.halcomp.newpin("toolchange-number", hal.HAL_S32, hal.HAL_IN) - self.halcomp.newpin("toolchange-changed", hal.HAL_BIT, hal.HAL_OUT) - pin = self.halcomp.newpin('toolchange-change', hal.HAL_BIT, hal.HAL_IN) + self.halcomp.newpin("toolchange-number", hal.Type.SINT, hal.Dir.IN) + self.halcomp.newpin("toolchange-changed", hal.Type.BOOL, hal.Dir.OUT) + pin = self.halcomp.newpin('toolchange-change', hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect('value_changed', self.on_tool_change) - self.halcomp.newpin('toolchange-confirm', hal.HAL_BIT, hal.HAL_IN) + self.halcomp.newpin('toolchange-confirm', hal.Type.BOOL, hal.Dir.IN) # make a pin to confirm a warning dialog - self.halcomp.newpin('warning-confirm', hal.HAL_BIT, hal.HAL_IN) + self.halcomp.newpin('warning-confirm', hal.Type.BOOL, hal.Dir.IN) # make a pin to reset feed override to 100 % - pin = self.halcomp.newpin("feed.reset-feed-override", hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("feed.reset-feed-override", hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._reset_override, "feed") # make a pin to reset rapid override to 100 % - pin = self.halcomp.newpin("rapid.reset-rapid-override", hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("rapid.reset-rapid-override", hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._reset_override, "rapid") # make a pin to reset spindle override to 100 % - pin = self.halcomp.newpin("spindle.reset-spindle-override", hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("spindle.reset-spindle-override", hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._reset_override, "spindle") # make an error pin to indicate a error to hardware - self.halcomp.newpin("error", hal.HAL_BIT, hal.HAL_OUT) + self.halcomp.newpin("error", hal.Type.BOOL, hal.Dir.OUT) # make pins to indicate program progress information - self.halcomp.newpin("program.length", hal.HAL_S32, hal.HAL_OUT) - self.halcomp.newpin("program.current-line", hal.HAL_S32, hal.HAL_OUT) - self.halcomp.newpin("program.progress", hal.HAL_FLOAT, hal.HAL_OUT) + self.halcomp.newpin("program.length", hal.Type.SINT, hal.Dir.OUT) + self.halcomp.newpin("program.current-line", hal.Type.SINT, hal.Dir.OUT) + self.halcomp.newpin("program.progress", hal.Type.REAL, hal.Dir.OUT) # make a pin to set ignore limits - pin = self.halcomp.newpin("ignore-limits", hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("ignore-limits", hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._ignore_limits) # make pins to set optional stops and block delete - pin = self.halcomp.newpin("optional-stop", hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("optional-stop", hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._optional_blocks) - pin = self.halcomp.newpin("blockdelete", hal.HAL_BIT, hal.HAL_IN) + pin = self.halcomp.newpin("blockdelete", hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._blockdelete) diff --git a/src/emc/usr_intf/gscreen/gscreen.py b/src/emc/usr_intf/gscreen/gscreen.py index a8d10ca6058..42ca2ec21e1 100755 --- a/src/emc/usr_intf/gscreen/gscreen.py +++ b/src/emc/usr_intf/gscreen/gscreen.py @@ -1652,49 +1652,49 @@ def initialize_pins(self): def init_spindle_pins(self): """creates a HAL float in pin for control the spindle readout meter """ - self.halcomp.newpin("spindle-readout-in", hal.HAL_FLOAT, hal.HAL_IN) + self.halcomp.newpin("spindle-readout-in", hal.Type.REAL, hal.Dir.IN) def init_coolant_pins(self): - """create HAL BIT out pins to control coolant + """create HAL BOOL out pins to control coolant """ - self.halcomp.newpin("aux-coolant-m7-out", hal.HAL_BIT, hal.HAL_OUT) - self.halcomp.newpin("aux-coolant-m8-out", hal.HAL_BIT, hal.HAL_OUT) - self.halcomp.newpin("mist-coolant-out", hal.HAL_BIT, hal.HAL_OUT) - self.halcomp.newpin("flood-coolant-out", hal.HAL_BIT, hal.HAL_OUT) + self.halcomp.newpin("aux-coolant-m7-out", hal.Type.BOOL, hal.Dir.OUT) + self.halcomp.newpin("aux-coolant-m8-out", hal.Type.BOOL, hal.Dir.OUT) + self.halcomp.newpin("mist-coolant-out", hal.Type.BOOL, hal.Dir.OUT) + self.halcomp.newpin("flood-coolant-out", hal.Type.BOOL, hal.Dir.OUT) def init_jog_pins(self): - """create HAL BIT out pins for all axis jog enable - create HAL BIT out for jog mode enabled - create HAL FLOAT out pin for current jog increment + """create HAL BOOL out pins for all axis jog enable + create HAL BOOL out for jog mode enabled + create HAL REAL out pin for current jog increment These could be used for MPG selecting """ for axis in self.data.axis_list: - self.halcomp.newpin("jog-enable-%s-out"% (axis), hal.HAL_BIT, hal.HAL_OUT) - self.halcomp.newpin("jog-enable-out", hal.HAL_BIT, hal.HAL_OUT) - self.halcomp.newpin("jog-increment-out", hal.HAL_FLOAT, hal.HAL_OUT) - #self.data['jog-increment-in'] = hal_glib.GPin(self.halcomp.newpin('jog-increment-in', hal.HAL_S32, hal.HAL_IN)) + self.halcomp.newpin("jog-enable-%s-out"% (axis), hal.Type.BOOL, hal.Dir.OUT) + self.halcomp.newpin("jog-enable-out", hal.Type.BOOL, hal.Dir.OUT) + self.halcomp.newpin("jog-increment-out", hal.Type.REAL, hal.Dir.OUT) + #self.data['jog-increment-in'] = hal_glib.GPin(self.halcomp.newpin('jog-increment-in', hal.Type.SINT, hal.Dir.IN)) #self.data['jog-increment-in'].connect('value-changed', self.on_hal_jog_increments_changed) - #self.data['jog-rate-in'] = hal_glib.GPin(self.halcomp.newpin('jog-rate-in', hal.HAL_S32, hal.HAL_IN)) + #self.data['jog-rate-in'] = hal_glib.GPin(self.halcomp.newpin('jog-rate-in', hal.Type.SINT, hal.Dir.IN)) #self.data['jog-rate-in'].connect('value-changed', self.on_hal_jog_rate_changed) # pins used for selecting an encoder to adjust overrides def init_override_pins(self): - """creates HAL BIT pins for spindle,feed and Max velocity overrides. + """creates HAL BOOL pins for spindle,feed and Max velocity overrides. used as selection pins for an encoder to set values """ - self.halcomp.newpin("s-override-enable-out", hal.HAL_BIT, hal.HAL_OUT) - self.halcomp.newpin("f-override-enable-out", hal.HAL_BIT, hal.HAL_OUT) - self.halcomp.newpin("mv-override-enable-out", hal.HAL_BIT, hal.HAL_OUT) + self.halcomp.newpin("s-override-enable-out", hal.Type.BOOL, hal.Dir.OUT) + self.halcomp.newpin("f-override-enable-out", hal.Type.BOOL, hal.Dir.OUT) + self.halcomp.newpin("mv-override-enable-out", hal.Type.BOOL, hal.Dir.OUT) def init_control_pins(self): """Creates and registers function calls for start,abort and feed_hold pins calls self.on_cycle_start_changed, self.on_abort_changed, self.on_feed_hold_changed """ - self.data['cycle_start'] = hal_glib.GPin(self.halcomp.newpin('cycle-start', hal.HAL_BIT, hal.HAL_IN)) + self.data['cycle_start'] = hal_glib.GPin(self.halcomp.newpin('cycle-start', hal.Type.BOOL, hal.Dir.IN)) self.data['cycle_start'].connect('value-changed', self.on_cycle_start_changed) - self.data['abort'] = hal_glib.GPin(self.halcomp.newpin('abort', hal.HAL_BIT, hal.HAL_IN)) + self.data['abort'] = hal_glib.GPin(self.halcomp.newpin('abort', hal.Type.BOOL, hal.Dir.IN)) self.data['abort'].connect('value-changed', self.on_abort_changed) - self.data['feed_hold'] = hal_glib.GPin(self.halcomp.newpin('feed-hold', hal.HAL_BIT, hal.HAL_IN)) + self.data['feed_hold'] = hal_glib.GPin(self.halcomp.newpin('feed-hold', hal.Type.BOOL, hal.Dir.IN)) self.data['feed_hold'].connect('value-changed', self.on_feed_hold_changed) def initialize_manual_toolchange(self): @@ -1706,9 +1706,9 @@ def initialize_manual_toolchange(self): or the default function """ # for manual tool change dialog - self.halcomp.newpin("tool-number", hal.HAL_S32, hal.HAL_IN) - self.halcomp.newpin("tool-changed", hal.HAL_BIT, hal.HAL_OUT) - self.data['change-tool'] = hal_glib.GPin(self.halcomp.newpin('change-tool', hal.HAL_BIT, hal.HAL_IN)) + self.halcomp.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) + self.halcomp.newpin("tool-changed", hal.Type.BOOL, hal.Dir.OUT) + self.data['change-tool'] = hal_glib.GPin(self.halcomp.newpin('change-tool', hal.Type.BOOL, hal.Dir.IN)) # you can override manual tool change if "on_tool_change" in dir(self.handler_instance): self.data['change-tool'].connect('value-changed', self.handler_instance.on_tool_change) @@ -3808,12 +3808,12 @@ def message_setup(self): continue if not name == None: # this is how we make a pin that can be connected to a callback - self.data['name'] = hal_glib.GPin(self.halcomp.newpin(name, hal.HAL_BIT, hal.HAL_IN)) + self.data['name'] = hal_glib.GPin(self.halcomp.newpin(name, hal.Type.BOOL, hal.Dir.IN)) self.data['name'].connect('value-changed', self.on_printmessage,name,bt,t,c) if ("dialog" in c): - self.halcomp.newpin(name+"-waiting", hal.HAL_BIT, hal.HAL_OUT) + self.halcomp.newpin(name+"-waiting", hal.Type.BOOL, hal.Dir.OUT) if not ("ok" in c): - self.halcomp.newpin(name+"-response", hal.HAL_BIT, hal.HAL_OUT) + self.halcomp.newpin(name+"-response", hal.Type.BOOL, hal.Dir.OUT) # display dialog def warning_dialog(self,message, displaytype, secondary=None,pinname=None): diff --git a/src/emc/usr_intf/mdro/mdro.py b/src/emc/usr_intf/mdro/mdro.py index e1ac9c3a635..f0848ca4136 100755 --- a/src/emc/usr_intf/mdro/mdro.py +++ b/src/emc/usr_intf/mdro/mdro.py @@ -34,10 +34,10 @@ def __init__(self): self.h = hal.component("mdro") self.pins = ["axis."+str(p) for p in range(params["naxes"])] for pin in self.pins: - self.h.newpin(pin, hal.HAL_FLOAT, hal.HAL_IN) + self.h.newpin(pin, hal.Type.REAL, hal.Dir.IN) self.indexes = ["index-enable."+str(p) for p in range(params["naxes"])] for pin in self.indexes: - self.h.newpin(pin, hal.HAL_BIT, hal.HAL_IO) + self.h.newpin(pin, hal.Type.BOOL, hal.Dir.IO) self.h.ready() if params["verbose"]: print("Linuxcnc interface up") diff --git a/src/emc/usr_intf/pncconf/options.glade b/src/emc/usr_intf/pncconf/options.glade index caab2c39f70..4788efe0990 100644 --- a/src/emc/usr_intf/pncconf/options.glade +++ b/src/emc/usr_intf/pncconf/options.glade @@ -602,7 +602,7 @@ True False 5 - Number of digital (bit) in pins: + Number of digital (bool) in pins: True digitsin 0.019999999552965164 @@ -619,7 +619,7 @@ True False 3 - Number of digital (bit) out pins: + Number of digital (bool) out pins: True digitsout 0.039999999105930328 @@ -635,7 +635,7 @@ True False 6 - Number of analog (s32) in pins: + Number of analog (sint) in pins: True word-char s32in @@ -652,7 +652,7 @@ True False 5 - Number of analog (s32) out pins: + Number of analog (sint) out pins: True s32out 0 @@ -668,7 +668,7 @@ True False 5 - Number of analog (float) in pins: + Number of analog (real) in pins: True s32out 0 @@ -684,7 +684,7 @@ True False 5 - Number of analog (float) out pins: + Number of analog (real) out pins: True s32out 0 diff --git a/src/emc/usr_intf/pncconf/tests.py b/src/emc/usr_intf/pncconf/tests.py index 10f411ef3d9..09242a401b2 100644 --- a/src/emc/usr_intf/pncconf/tests.py +++ b/src/emc/usr_intf/pncconf/tests.py @@ -616,7 +616,7 @@ def get_value(d): # do I/O write commands for i in write: halrun.write('%s\n'%i) - halrun.write( "newsig estop-out bit\n") + halrun.write( "newsig estop-out bool\n") halrun.write( "sets estop-out false\n") halrun.write("setp pid.0.Pgain %d\n"% ( w[axis+"P"].get_value() )) halrun.write("setp pid.0.Igain %d\n"% ( w[axis+"I"].get_value() )) @@ -973,11 +973,11 @@ def get_value(d): halrun.write( "addf charge-pump servo-thread\n") for i in write: halrun.write('%s\n'%i) - halrun.write( "newsig estop-out bit\n") + halrun.write( "newsig estop-out bool\n") halrun.write( "sets estop-out false\n") - halrun.write( "newsig enable-not bit\n") - halrun.write( "newsig dir-not bit\n") - halrun.write( "newsig dir bit\n") + halrun.write( "newsig enable-not bool\n") + halrun.write( "newsig dir-not bool\n") + halrun.write( "newsig dir bool\n") # search for pins with test signals that may be needed to enable amp self.hal_test_signals(axis) @@ -1415,7 +1415,7 @@ def update(self): def make_blank(self,container,boardnum,number): #blankname = "enc-%d" % (number) #self.data2["brd%denc%d" % (boardnum,number)]= Gtk.Button("Reset-%d"% number) - #self.hal.c.newpin(encname, hal.HAL_S32, hal.HAL_IN) + #self.hal.c.newpin(encname, hal.Type.SINT, hal.Dir.IN) label = Gtk.Label(" ") container.pack_start(label, False, False, 10) label = Gtk.Label(" ") @@ -1425,15 +1425,15 @@ def make_blank(self,container,boardnum,number): def make_enc(self,container,boardnum,number): encname = "brd.%d.enc.%d.reset" % (boardnum,number) print("making HAL pin enc bit Brd %d,num %d"%(boardnum,number)) - self.hal.c.newpin(encname, hal.HAL_BIT, hal.HAL_OUT) - hal.new_sig(encname+"-signal",hal.HAL_BIT) + self.hal.c.newpin(encname, hal.Type.BOOL, hal.Dir.OUT) + hal.new_sig(encname+"-signal",hal.Type.BOOL) hal.connect("testpanel."+encname,encname+"-signal") self.data2["brd%denc%dreset" % (boardnum,number)]= Gtk.Button("Reset-%d"% number) container.pack_start(self.data2["brd%denc%dreset" % (boardnum,number)], False, False, 10) encname = "brd.%d.enc.%d.count" % (boardnum,number) print("making HAL pin enc s32 brd %d num %d"%(boardnum,number)) - self.hal.c.newpin(encname, hal.HAL_S32, hal.HAL_IN) - hal.new_sig(encname+"-signal",hal.HAL_S32) + self.hal.c.newpin(encname, hal.Type.SINT, hal.Dir.IN) + hal.new_sig(encname+"-signal",hal.Type.SINT) hal.connect("testpanel."+encname,encname+"-signal") label = self.data2["brd%denc%dcount" % (boardnum,number)] = Gtk.Label("Encoder-%d"% (number)) label.set_size_request(100, -1) @@ -1442,12 +1442,12 @@ def make_enc(self,container,boardnum,number): # This creates widgets and HAL pins for stepper controls def make_stp(self,container,boardnum,number): stpname = "brd.%d.stp.%d.position-cmd" % (boardnum,number) - self.hal.c.newpin(stpname, hal.HAL_FLOAT, hal.HAL_OUT) - hal.new_sig(stpname+"-signal",hal.HAL_FLOAT) + self.hal.c.newpin(stpname, hal.Type.REAL, hal.Dir.OUT) + hal.new_sig(stpname+"-signal",hal.Type.REAL) hal.connect("testpanel."+stpname,stpname+"-signal") stpname = "brd.%d.stp.%d.enable" % (boardnum,number) - self.hal.c.newpin(stpname, hal.HAL_BIT, hal.HAL_OUT) - hal.new_sig(stpname+"-signal",hal.HAL_BIT) + self.hal.c.newpin(stpname, hal.Type.BOOL, hal.Dir.OUT) + hal.new_sig(stpname+"-signal",hal.Type.BOOL) hal.connect("testpanel."+stpname,stpname+"-signal") adj = Gtk.Adjustment(0.0, -1000.0, 1000.0, 1.0, 5.0, 0.0) spin = self.data2["brd%dstp%dcmd" % (boardnum,number)]= Gtk.SpinButton(adj, 0, 1) @@ -1462,13 +1462,13 @@ def make_stp(self,container,boardnum,number): def make_pwm(self,container,boardnum,number): pwmname = "brd.%d.pwm.%d.value" % (boardnum,number) print("making HAL pin pwm float brd%d num %d"%(boardnum,number)) - self.hal.c.newpin(pwmname, hal.HAL_FLOAT, hal.HAL_OUT) - hal.new_sig(pwmname+"-signal",hal.HAL_FLOAT) + self.hal.c.newpin(pwmname, hal.Type.REAL, hal.Dir.OUT) + hal.new_sig(pwmname+"-signal",hal.Type.REAL) hal.connect("testpanel."+pwmname,pwmname+"-signal") pwmname = "brd.%d.pwm.%d.enable" % (boardnum,number) print("making HAL pin pwm bit brd %d num %d"%(boardnum,number)) - self.hal.c.newpin(pwmname, hal.HAL_BIT, hal.HAL_OUT) - hal.new_sig(pwmname+"-signal",hal.HAL_BIT) + self.hal.c.newpin(pwmname, hal.Type.BOOL, hal.Dir.OUT) + hal.new_sig(pwmname+"-signal",hal.Type.BOOL) hal.connect("testpanel."+pwmname,pwmname+"-signal") adj = self.data2["brd%dpwm%dadj" % (boardnum,number)] = Gtk.Adjustment(0.0, -10.0, 10.0, 0.1, 0.5, 0.0) adj.connect("value_changed", self.pwm_callback,"pwm",boardnum,number,None) @@ -1486,8 +1486,8 @@ def make_pwm(self,container,boardnum,number): def make_led(self,container,boardnum,number): ledname = "brd.%d.led.%d" % (boardnum,number) print("making HAL pin led bit brd %d num %d"%(boardnum,number)) - self.hal.c.newpin(ledname, hal.HAL_BIT, hal.HAL_IN) - hal.new_sig(ledname+"-signal",hal.HAL_BIT) + self.hal.c.newpin(ledname, hal.Type.BOOL, hal.Dir.IN) + hal.new_sig(ledname+"-signal",hal.Type.BOOL) hal.connect("testpanel."+ledname,ledname+"-signal") led = self.data2["brd%dled%d" % (boardnum,number)] = LED(self) led.set_color("off",[1,0,0]) # red @@ -1503,8 +1503,8 @@ def make_switch(self,container,boardnum,number): # make a HAL pin switchname = "brd.%d.switch.%d" % (boardnum,number) print("making HAL pin switch bit brd %d num %d"%(boardnum,number)) - self.hal.c.newpin(switchname, hal.HAL_BIT, hal.HAL_OUT) - hal.new_sig(switchname+"-signal",hal.HAL_BIT) + self.hal.c.newpin(switchname, hal.Type.BOOL, hal.Dir.OUT) + hal.new_sig(switchname+"-signal",hal.Type.BOOL) hal.connect("testpanel."+switchname,switchname+"-signal") # add button to container using boarnum and number as a reference button = self.data2["brd%dswch%d" % (boardnum,number)]= Gtk.Button("OUT-%d"% number) diff --git a/src/emc/usr_intf/pyui/widgets.py b/src/emc/usr_intf/pyui/widgets.py index 0a037ea216b..bb63b98452a 100644 --- a/src/emc/usr_intf/pyui/widgets.py +++ b/src/emc/usr_intf/pyui/widgets.py @@ -30,19 +30,19 @@ def hal_init(self, master, comp, name,metadata,command,widgets,dbg): # convert and set pintype and states based on metadata types if self.metadata['OUTPUT'] == 'S32': - self.pintype=hal.HAL_S32 + self.pintype=hal.Type.SINT self.true_state = int(self.metadata['TRUE_STATE']) self.false_state = int(self.metadata['FALSE_STATE']) elif self.metadata['OUTPUT'] == 'U32': - self.pintype=hal.HAL_U32 + self.pintype=hal.Type.UINT self.true_state = int(self.metadata['TRUE_STATE']) self.false_state = int(self.metadata['FALSE_STATE']) elif self.metadata['OUTPUT'] == 'FLOAT': - self.pintype=hal.HAL_FLOAT + self.pintype=hal.Type.REAL self.true_state = float(self.metadata['TRUE_STATE']) self.false_state = float(self.metadata['FALSE_STATE']) elif self.metadata['OUTPUT'] == 'BIT': - self.pintype=hal.HAL_BIT + self.pintype=hal.Type.BOOL self.true_state = True#self.metadata['TRUE_STATE'] self.false_state = False#self.metadata['FALSE_STATE'] elif self.metadata['OUTPUT'] == 'COMMAND': @@ -104,12 +104,12 @@ def _hal_init(self): pass # If not a command output requested make the pins if pintype not in(None,'COMMAND','ZMQ'): - self.hal_pin = self.hal.newpin(self.hal_name, pintype, hal.HAL_OUT) - self.hal_pin_not = self.hal.newpin(self.hal_name + "-not", pintype, hal.HAL_OUT) + self.hal_pin = self.hal.newpin(self.hal_name, pintype, hal.Dir.OUT) + self.hal_pin_not = self.hal.newpin(self.hal_name + "-not", pintype, hal.Dir.OUT) # If there is a status requested make there pins if self.status_pin: - self.hal_status_pin = self.hal.newpin(self.hal_name+ "-state", hal.HAL_BIT, hal.HAL_OUT) - self.hal_status_pin_not = self.hal.newpin(self.hal_name+ "-state-not", hal.HAL_BIT, hal.HAL_OUT) + self.hal_status_pin = self.hal.newpin(self.hal_name+ "-state", hal.Type.BOOL, hal.Dir.OUT) + self.hal_status_pin_not = self.hal.newpin(self.hal_name+ "-state-not", hal.Type.BOOL, hal.Dir.OUT) # Update the pin to the proper state, but don't print debug for this if pintype not in ('COMMAND','ZMQ'): DBG_suppress = True diff --git a/src/emc/usr_intf/touchy/hal_interface.py b/src/emc/usr_intf/touchy/hal_interface.py index f53808f3683..18802297492 100644 --- a/src/emc/usr_intf/touchy/hal_interface.py +++ b/src/emc/usr_intf/touchy/hal_interface.py @@ -22,67 +22,67 @@ def __init__(self, gui, emc_control, mdi_control, emc): self.emc_stat = self.emc.stat() self.mdi_control = mdi_control self.c = hal.component("touchy") - self.c.newpin("status-indicator", hal.HAL_BIT, hal.HAL_OUT) - self.c.newpin("jog.active", hal.HAL_BIT, hal.HAL_OUT) - self.c.newpin("jog.wheel.x", hal.HAL_BIT, hal.HAL_OUT) - self.c.newpin("jog.wheel.y", hal.HAL_BIT, hal.HAL_OUT) - self.c.newpin("jog.wheel.z", hal.HAL_BIT, hal.HAL_OUT) - self.c.newpin("jog.wheel.a", hal.HAL_BIT, hal.HAL_OUT) - self.c.newpin("jog.wheel.b", hal.HAL_BIT, hal.HAL_OUT) - self.c.newpin("jog.wheel.c", hal.HAL_BIT, hal.HAL_OUT) - self.c.newpin("jog.wheel.u", hal.HAL_BIT, hal.HAL_OUT) - self.c.newpin("jog.wheel.v", hal.HAL_BIT, hal.HAL_OUT) - self.c.newpin("jog.wheel.w", hal.HAL_BIT, hal.HAL_OUT) - self.c.newpin("jog.wheel.increment", hal.HAL_FLOAT, hal.HAL_OUT) - - self.c.newpin("jog.continuous.x.positive", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("status-indicator", hal.Type.BOOL, hal.Dir.OUT) + self.c.newpin("jog.active", hal.Type.BOOL, hal.Dir.OUT) + self.c.newpin("jog.wheel.x", hal.Type.BOOL, hal.Dir.OUT) + self.c.newpin("jog.wheel.y", hal.Type.BOOL, hal.Dir.OUT) + self.c.newpin("jog.wheel.z", hal.Type.BOOL, hal.Dir.OUT) + self.c.newpin("jog.wheel.a", hal.Type.BOOL, hal.Dir.OUT) + self.c.newpin("jog.wheel.b", hal.Type.BOOL, hal.Dir.OUT) + self.c.newpin("jog.wheel.c", hal.Type.BOOL, hal.Dir.OUT) + self.c.newpin("jog.wheel.u", hal.Type.BOOL, hal.Dir.OUT) + self.c.newpin("jog.wheel.v", hal.Type.BOOL, hal.Dir.OUT) + self.c.newpin("jog.wheel.w", hal.Type.BOOL, hal.Dir.OUT) + self.c.newpin("jog.wheel.increment", hal.Type.REAL, hal.Dir.OUT) + + self.c.newpin("jog.continuous.x.positive", hal.Type.BOOL, hal.Dir.IN) self.xp = 0 - self.c.newpin("jog.continuous.x.negative", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.x.negative", hal.Type.BOOL, hal.Dir.IN) self.xn = 0 - self.c.newpin("jog.continuous.y.positive", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.y.positive", hal.Type.BOOL, hal.Dir.IN) self.yp = 0 - self.c.newpin("jog.continuous.y.negative", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.y.negative", hal.Type.BOOL, hal.Dir.IN) self.yn = 0 - self.c.newpin("jog.continuous.z.positive", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.z.positive", hal.Type.BOOL, hal.Dir.IN) self.zp = 0 - self.c.newpin("jog.continuous.z.negative", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.z.negative", hal.Type.BOOL, hal.Dir.IN) self.zn = 0 - self.c.newpin("jog.continuous.a.positive", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.a.positive", hal.Type.BOOL, hal.Dir.IN) self.ap = 0 - self.c.newpin("jog.continuous.a.negative", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.a.negative", hal.Type.BOOL, hal.Dir.IN) self.an = 0 - self.c.newpin("jog.continuous.b.positive", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.b.positive", hal.Type.BOOL, hal.Dir.IN) self.bp = 0 - self.c.newpin("jog.continuous.b.negative", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.b.negative", hal.Type.BOOL, hal.Dir.IN) self.bn = 0 - self.c.newpin("jog.continuous.c.positive", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.c.positive", hal.Type.BOOL, hal.Dir.IN) self.cp = 0 - self.c.newpin("jog.continuous.c.negative", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.c.negative", hal.Type.BOOL, hal.Dir.IN) self.cn = 0 - self.c.newpin("jog.continuous.u.positive", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.u.positive", hal.Type.BOOL, hal.Dir.IN) self.up = 0 - self.c.newpin("jog.continuous.u.negative", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.u.negative", hal.Type.BOOL, hal.Dir.IN) self.un = 0 - self.c.newpin("jog.continuous.v.positive", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.v.positive", hal.Type.BOOL, hal.Dir.IN) self.vp = 0 - self.c.newpin("jog.continuous.v.negative", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.v.negative", hal.Type.BOOL, hal.Dir.IN) self.vn = 0 - self.c.newpin("jog.continuous.w.positive", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.w.positive", hal.Type.BOOL, hal.Dir.IN) self.wp = 0 - self.c.newpin("jog.continuous.w.negative", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("jog.continuous.w.negative", hal.Type.BOOL, hal.Dir.IN) self.wn = 0 - self.c.newpin("quill-up", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("quill-up", hal.Type.BOOL, hal.Dir.IN) self.quillup = 0 - self.c.newpin("cycle-start", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("cycle-start", hal.Type.BOOL, hal.Dir.IN) self.cyclestart = 0 - self.c.newpin("abort", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("abort", hal.Type.BOOL, hal.Dir.IN) self.abort = 0 - self.c.newpin("single-block", hal.HAL_BIT, hal.HAL_IN) + self.c.newpin("single-block", hal.Type.BOOL, hal.Dir.IN) self.singleblock = 0 - self.c.newpin("wheel-counts", hal.HAL_S32, hal.HAL_IN) + self.c.newpin("wheel-counts", hal.Type.SINT, hal.Dir.IN) self.counts = 0 self.jog_velocity = 1 self.c.ready() diff --git a/src/hal/classicladder/module_hal.c b/src/hal/classicladder/module_hal.c index d3ac7495548..bb72cb84f29 100644 --- a/src/hal/classicladder/module_hal.c +++ b/src/hal/classicladder/module_hal.c @@ -178,7 +178,7 @@ int rtapi_app_main(void) { rtapi_print("creating ladder-state\n"); - result = hal_export_funct("classicladder.0.refresh",hal_task,0,1, 0, compId); + result = hal_export_funct("classicladder.0.refresh", hal_task, 0, 0, compId); if(result < 0) { error: hal_exit(compId); diff --git a/src/hal/components/.gitignore b/src/hal/components/.gitignore index 01a447a5a38..c18fb61471b 100644 --- a/src/hal/components/.gitignore +++ b/src/hal/components/.gitignore @@ -1 +1,2 @@ conv_*.comp +!conv_real_bool.comp diff --git a/src/hal/components/Submakefile b/src/hal/components/Submakefile index 62c9940cfbb..6c6ed4850de 100644 --- a/src/hal/components/Submakefile +++ b/src/hal/components/Submakefile @@ -3,35 +3,17 @@ COMPS := $(filter-out %/tpcomp.comp, $(patsubst $(BASEPWD)/%,%,$(wildcard $(BASE include $(patsubst %.comp, $(BASEPWD)/objects/%.mak, $(COMPS)) else CONVERTERS := \ - conv_bit_float.comp \ - conv_bit_s32.comp \ - conv_bit_u32.comp \ - conv_bit_s64.comp \ - conv_bit_u64.comp \ - conv_float_s32.comp \ - conv_float_u32.comp \ - conv_float_s64.comp \ - conv_float_u64.comp \ - conv_s32_bit.comp \ - conv_s32_float.comp \ - conv_s32_u32.comp \ - conv_s32_s64.comp \ - conv_s32_u64.comp \ - conv_s64_bit.comp \ - conv_s64_float.comp \ - conv_s64_s32.comp \ - conv_s64_u32.comp \ - conv_s64_u64.comp \ - conv_u32_bit.comp \ - conv_u32_float.comp \ - conv_u32_s32.comp \ - conv_u32_s64.comp \ - conv_u32_u64.comp \ - conv_u64_bit.comp \ - conv_u64_float.comp \ - conv_u64_s32.comp \ - conv_u64_u32.comp \ - conv_u64_s64.comp + conv_bool_real.comp \ + conv_bool_sint.comp \ + conv_bool_uint.comp \ + conv_real_sint.comp \ + conv_real_uint.comp \ + conv_sint_bool.comp \ + conv_sint_real.comp \ + conv_sint_uint.comp \ + conv_uint_bool.comp \ + conv_uint_real.comp \ + conv_uint_sint.comp COMPS := $(filter-out hal/components/tpcomp.comp, $(sort $(wildcard hal/components/*.comp) $(addprefix hal/components/, $(CONVERTERS)))) COMP_MANPAGES := $(patsubst hal/components/%.comp, ../docs/build/man/man9/%.9, $(COMPS)) ../docs/build/man/man9/tpcomp.9 ifeq ($(BUILD_SYS),uspace) @@ -136,118 +118,46 @@ PYFLAGS := $(PYTHON_EXTRA_LDFLAGS) $(BOOST_PYTHON_LIB) $(PYTHON_LIBS) $(PYTHON_E $(Q)$(CC) -Wl,-z,relro -o $@ $^ $(PYFLAGS) TARGETS += ../bin/panelui -hal/components/conv_float_s32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_real_sint.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh float s32 < $< > $@ + $(Q)sh hal/components/mkconv.sh real sint < $< > $@ -hal/components/conv_float_u32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_real_uint.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh float u32 < $< > $@ + $(Q)sh hal/components/mkconv.sh real uint < $< > $@ -hal/components/conv_float_s64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_bool_sint.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh float s64 < $< > $@ + $(Q)sh hal/components/mkconv.sh bool sint < $< > $@ -hal/components/conv_float_u64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_bool_uint.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh float u64 < $< > $@ + $(Q)sh hal/components/mkconv.sh bool uint < $< > $@ -hal/components/conv_bit_s32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_bool_real.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh bit s32 < $< > $@ + $(Q)sh hal/components/mkconv.sh bool real < $< > $@ -hal/components/conv_bit_u32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_sint_real.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh bit u32 < $< > $@ + $(Q)sh hal/components/mkconv.sh sint real < $< > $@ -hal/components/conv_bit_s64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_sint_bool.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh bit s64 < $< > $@ + $(Q)sh hal/components/mkconv.sh sint bool < $< > $@ -hal/components/conv_bit_u64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_sint_uint.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh bit u64 < $< > $@ + $(Q)sh hal/components/mkconv.sh sint uint < $< > $@ -hal/components/conv_bit_float.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_uint_real.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh bit float < $< > $@ + $(Q)sh hal/components/mkconv.sh uint real < $< > $@ -hal/components/conv_s32_float.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_uint_bool.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s32 float < $< > $@ + $(Q)sh hal/components/mkconv.sh uint bool < $< > $@ -hal/components/conv_s32_bit.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_uint_sint.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s32 bit < $< > $@ - -hal/components/conv_s32_u32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s32 u32 < $< > $@ - -hal/components/conv_s32_u64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s32 u64 < $< > $@ - -hal/components/conv_s32_s64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s32 s64 < $< > $@ - -hal/components/conv_u32_float.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u32 float < $< > $@ - -hal/components/conv_u32_bit.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u32 bit < $< > $@ - -hal/components/conv_u32_s32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u32 s32 < $< > $@ - -hal/components/conv_u32_u64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u32 u64 < $< > $@ - -hal/components/conv_u32_s64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u32 s64 < $< > $@ - -hal/components/conv_s64_float.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s64 float < $< > $@ - -hal/components/conv_s64_bit.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s64 bit < $< > $@ - -hal/components/conv_s64_u32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s64 u32 < $< > $@ - -hal/components/conv_s64_s32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s64 s32 < $< > $@ - -hal/components/conv_s64_u64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s64 u64 < $< > $@ - -hal/components/conv_u64_float.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u64 float < $< > $@ - -hal/components/conv_u64_bit.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u64 bit < $< > $@ - -hal/components/conv_u64_u32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u64 u32 < $< > $@ - -hal/components/conv_u64_s32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u64 s32 < $< > $@ - -hal/components/conv_u64_s64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u64 s64 < $< > $@ + $(Q)sh hal/components/mkconv.sh uint sint < $< > $@ diff --git a/src/hal/components/abs_s32.comp b/src/hal/components/abs_s32.comp deleted file mode 100644 index 4ee33a9cf4e..00000000000 --- a/src/hal/components/abs_s32.comp +++ /dev/null @@ -1,41 +0,0 @@ -// This is a component for LinuxCNC HAL -// Copyright 2011 Sebastian Kuzminsky -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the GNU General -// Public License as published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -component abs_s32 "Compute the absolute value and sign of a integer input signal"; - -pin in si32 in "input value" ; -pin out si32 out "output value, always non-negative"; -pin out bool sign "Sign of input, false for positive, true for negative" ; -pin out bool is_positive_ "TRUE if input is positive, FALSE if input is 0 or negative"; -pin out bool is_negative_ "TRUE if input is negative, FALSE if input is 0 or positive"; - -option period no; -function _; -license "GPL"; -author "Sebastian Kuzminsky"; -;; -FUNCTION(_) { - rtapi_s32 i = in; - if ( i >= 0 ) { - sign_set(false); - out_set(i); - } else { - sign_set(true); - out_set(-i); - } - - is_positive__set(i > 0); - is_negative__set(i < 0); -} diff --git a/src/hal/components/abs_s64.comp b/src/hal/components/abs_sint.comp similarity index 94% rename from src/hal/components/abs_s64.comp rename to src/hal/components/abs_sint.comp index 012552b83c6..311030c7e5a 100644 --- a/src/hal/components/abs_s64.comp +++ b/src/hal/components/abs_sint.comp @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -component abs_s64 "Computes the absolute value and sign of a 64 bit integer input signal"; +component abs_sint "Computes the absolute value and sign of an integer input signal"; pin in sint in "input value" ; pin out sint out "output value, always non-negative"; diff --git a/src/hal/components/anglejog.comp b/src/hal/components/anglejog.comp index 876d04bf66a..23b4747bffb 100644 --- a/src/hal/components/anglejog.comp +++ b/src/hal/components/anglejog.comp @@ -21,7 +21,7 @@ is false. The value in use is output on the current-scale pin. pin is false. The value in use is output on the current-angle-degrees pin. 4. The value of the iscale-factor pin multiplies counts-in internally -to support integer (s32) calculations for counting. The current-scale-out +to support integer calculations for counting. The current-scale-out is divided by the same amount. The pin is sampled only when the enable-in pin is false. The default value should work in most applications. @@ -37,9 +37,9 @@ Simulation Config: `configs/sim/axis/anglejog/anglejog.in` """; pin in bool enable_in "enables motion (disables alteration of angle and scale)"; -pin in si32 counts_in "MPG (wheel) counts"; +pin in sint counts_in "MPG (wheel) counts"; pin in real angle_degrees_in "vector angle"; -pin in si32 iscale_factor = 10000 "integer scaling factor (>1)"; +pin in sint iscale_factor = 10000 "integer scaling factor (>1)"; pin in real scale_in "magnitude units/count (mag = counts * scale)"; pin in real max_vel "vector max velocity magnitude"; pin in real max_accel "vector max acceleration magnitude"; @@ -48,8 +48,8 @@ pin in real accel_fraction_in = 1 "acceleration fraction input"; pin out bool enable_out "to: axis.M.jog-enable AND axis.N.jog-enable"; pin out real current_scale "effective scale (informational)"; pin out real current_scale_out "to: axis.M.jog-scale AND axis.N.jog-scale"; -pin out si32 coscounts "to: axis.M.jog-counts (cosine counts)"; -pin out si32 sincounts "to: axis.N.jog-counts (sine counts)"; +pin out sint coscounts "to: axis.M.jog-counts (cosine counts)"; +pin out sint sincounts "to: axis.N.jog-counts (sine counts)"; pin out real cos_accel_fraction "to: axis.M.jog-accel-fraction"; pin out real sin_accel_fraction "to: axis.N.jog-accel-fraction"; @@ -73,14 +73,14 @@ author "Dewey Garrett"; FUNCTION(_) { static bool once = 1; static bool wait_for_count_change = 0; -static int tot_counts; -static int old_enable_in; -static int old_counts_in; -static int ifactor = 0; +static rtapi_sint tot_counts; +static rtapi_bool old_enable_in; +static rtapi_sint old_counts_in; +static rtapi_sint ifactor = 0; double max_dv, tiny_dp, mag_err, vel_req; double mag_cmd; - int delta_counts = 0; - int newcounts; + rtapi_sint delta_counts = 0; + rtapi_sint newcounts; if (once) { current_angle_degrees_set(angle_degrees_in); @@ -147,12 +147,12 @@ static int ifactor = 0; if ( iscale_factor >= MIN_ISCALE_FACTOR && iscale_factor <= MAX_ISCALE_FACTOR) { ifactor = iscale_factor; - rtapi_print("new ifactor=%d\n",ifactor); + rtapi_print("new ifactor=%ld\n",ifactor); new_ifactor = 1; gave_msg = 0; } else { if (!gave_msg) { - rtapi_print("BOGUS iscale_factor=%d (min=%d max=%d)\n" + rtapi_print("BOGUS iscale_factor=%ld (min=%d max=%d)\n" ,ifactor,MIN_ISCALE_FACTOR,MAX_ISCALE_FACTOR); gave_msg = 1; } diff --git a/src/hal/components/axistest.comp b/src/hal/components/axistest.comp index a66f091e1e3..692b158f42c 100644 --- a/src/hal/components/axistest.comp +++ b/src/hal/components/axistest.comp @@ -5,7 +5,7 @@ pin in bool jog-plus "Drive TRUE to jog the axis in its positive direction."; pin in bool run "Drive TRUE to run the axis near its current position_fb with a trapezoidal velocity profile."; pin in real maxvel "Maximum velocity"; pin in real amplitude "Approximate amplitude of positions to command during 'run'"; -pin in si32 dir "Direction from central point to test: 0 = both, 1 = positive, 2 = negative"; +pin in sint dir "Direction from central point to test: 0 = both, 1 = positive, 2 = negative"; pin in real position-fb; pin out real position-cmd; pin out bool running; @@ -13,7 +13,7 @@ pin out real run-target; pin out real run-start; pin out real run-low; pin out real run-high; -pin in si32 pause = 0 "Pause time for each end of run in seconds"; +pin in sint pause = 0 "Pause time for each end of run in seconds"; param rw real epsilon = .001; variable double timer; param r real elapsed "Current value of the internal timer"; diff --git a/src/hal/components/bin2gray.comp b/src/hal/components/bin2gray.comp index 10c47d0c90f..527b6a28bed 100644 --- a/src/hal/components/bin2gray.comp +++ b/src/hal/components/bin2gray.comp @@ -1,11 +1,11 @@ component bin2gray "convert a number to the gray-code representation"; description """Converts a number into gray-code"""; -pin in ui32 in "binary code in"; -pin out ui32 out "gray code out"; +pin in uint in "binary code in"; +pin out uint out "gray code out"; license "GPL"; author "Andy Pugh"; option period no; function _; ;; -rtapi_u32 i = in; +rtapi_uint i = in; out_set((i >> 1) ^ i); diff --git a/src/hal/components/biquad.comp b/src/hal/components/biquad.comp index 7e42ad2eaea..936a68368a4 100644 --- a/src/hal/components/biquad.comp +++ b/src/hal/components/biquad.comp @@ -48,7 +48,7 @@ coefficients to be calculated according to the current \ pin out bool valid = 0 "When false, indicates an error occurred when calculating \ filter coefficients (require 2>**Q**>0.5 and *f0*>sampleRate/2)"; -pin in ui32 type_ = 0 "Filter type determines the type of filter \ +pin in uint type_ = 0 "Filter type determines the type of filter \ coefficients calculated. When 0, coefficients must be loaded directly \ from the *n0,n1,n2,d1* params. When 1, \ a low pass filter is created specified by the *f0,Q* pins. \ diff --git a/src/hal/components/bitmerge.comp b/src/hal/components/bitmerge.comp index 11760d35ce5..016c195b406 100644 --- a/src/hal/components/bitmerge.comp +++ b/src/hal/components/bitmerge.comp @@ -3,7 +3,7 @@ description """This component creates a compound unsigned-32 from individual bit-inputs for each bit of an unsigned-32 output. The number of bits can be limited by the "personality" modparam. The inverse process can be performed by the bitslice HAL component."""; -pin out ui32 out "The output value"; +pin out uint out "The output value"; pin in bool in-##[32:personality]; author "Andy Pugh"; license "GPL2+"; @@ -11,7 +11,7 @@ function _; option personality yes; option period no; ;; -rtapi_u32 v = 0; +rtapi_uint v = 0; for (int i = personality; i > 0;) { v <<= 1; if (in(--i)) diff --git a/src/hal/components/bitslice.comp b/src/hal/components/bitslice.comp index 11c440aae43..be3cf8735c2 100644 --- a/src/hal/components/bitslice.comp +++ b/src/hal/components/bitslice.comp @@ -3,7 +3,7 @@ description """This component creates individual bit-outputs for each bit of an unsigned-32 input. The number of bits can be limited by the "personality" modparam. The inverse process can be performed by the bitmerge HAL component."""; -pin in ui32 in "The input value"; +pin in uint in "The input value"; pin out bool out-##[32:personality]; author "Andy Pugh"; license "GPL2+"; @@ -11,7 +11,7 @@ function _; option personality yes; option period no; ;; -rtapi_u32 v = in; +rtapi_uint v = in; for (int i = 0; i < personality; i++) { out_set(i, v & 1); v >>= 1; diff --git a/src/hal/components/bitwise.comp b/src/hal/components/bitwise.comp index 38a0b6791be..55df2f0f77e 100644 --- a/src/hal/components/bitwise.comp +++ b/src/hal/components/bitwise.comp @@ -1,12 +1,12 @@ component bitwise "Computes various bitwise operations on the two input values"; -pin in ui32 in0 "First input value"; -pin in ui32 in1 "Second input value"; -pin out ui32 out-and "The bitwise AND of the two inputs"; -pin out ui32 out-or "The bitwise OR of the two inputs"; -pin out ui32 out-xor "The bitwise XOR of the two inputs"; -pin out ui32 out-nand "The inverse of the bitwise AND"; -pin out ui32 out-nor "The inverse of the bitwise OR"; -pin out ui32 out-xnor "The inverse of the bitwise XOR"; +pin in uint in0 "First input value"; +pin in uint in1 "Second input value"; +pin out uint out-and "The bitwise AND of the two inputs"; +pin out uint out-or "The bitwise OR of the two inputs"; +pin out uint out-xor "The bitwise XOR of the two inputs"; +pin out uint out-nand "The inverse of the bitwise AND"; +pin out uint out-nor "The inverse of the bitwise OR"; +pin out uint out-xnor "The inverse of the bitwise XOR"; author "Andy Pugh"; license "GPL 2+"; @@ -14,8 +14,8 @@ function _; option period no; ;; -rtapi_u32 i0 = in0; -rtapi_u32 i1 = in1; +rtapi_uint i0 = in0; +rtapi_uint i1 = in1; out_nand_set(~out_and_set(i0 & i1)); out_nor_set( ~out_or_set( i0 | i1)); out_xnor_set(~out_xor_set(i0 ^ i1)); diff --git a/src/hal/components/bldc.comp b/src/hal/components/bldc.comp index 438b330f9a1..3c4b9d5f762 100644 --- a/src/hal/components/bldc.comp +++ b/src/hal/components/bldc.comp @@ -91,28 +91,28 @@ pin out bool out-dir pin out real out-abs "Absolute value of the input value"; -param r si32 in_type = -1 "state machine output, will probably hide after debug"; -param r si32 out_type = -1 "state machine output, will probably hide after debug"; +param r sint in_type = -1 "state machine output, will probably hide after debug"; +param r sint out_type = -1 "state machine output, will probably hide after debug"; -param rw si32 scale = 512 if personality & 0x06 +param rw sint scale = 512 if personality & 0x06 "The number of encoder counts per rotor revolution."; -param rw si32 poles = 4 if personality & 0x06 +param rw sint poles = 4 if personality & 0x06 """The number of motor poles. The encoder scale will be divided by this value to determine the number of encoder counts per electrical revolution."""; -param rw si32 encoder-offset = 0 if personality & 0x0A +param rw sint encoder-offset = 0 if personality & 0x0A """The offset, in encoder counts, between the motor electrical zero and the encoder zero modulo the number of counts per electrical revolution"""; -param r si32 offset_measured = 0 if personality & 0x04 +param r sint offset_measured = 0 if personality & 0x04 """The encoder offset measured by the homing sequence (in certain modes)"""; param rw real drive-offset = 0 """The angle, in degrees, applied to the commanded angle by the drive in degrees. This value is only used during the homing sequence of drives with incremental encoder feedback. It is used to back-calculate from commanded angle to actual phase angle. It is only relevant to drives which expect rotor-angle input rather than phase-angle demand. Should be 0 for most drives."""; -param rw ui32 output-pattern=25 if personality & 0x400 +param rw uint output-pattern=25 if personality & 0x400 """Commutation pattern to be output in Hall Signal translation mode. See the description of *pattern* for details."""; -param rw ui32 pattern=25 if personality & 0x01 +param rw uint pattern=25 if personality & 0x01 """Commutation pattern to use, from 0 to 47. Default is type 25. Every plausible combination is included. The table below shows the excitation pattern along the top, and the pattern code on the left hand side. @@ -289,7 +289,7 @@ option count_function yes; variable int old_init = 0; variable char old_ph = 000; -variable int old_pattern = -1; +variable rtapi_sint old_pattern = -1; variable double counter = 0; variable rtapi_s64 long_rawcounts = 0; variable rtapi_s64 old_long_rawcounts = 0; @@ -431,7 +431,7 @@ FUNCTION(_) { if (pattern > 47){ rtapi_print_msg(RTAPI_MSG_ERR, "Only `Hall patterns 0-47 are allowed, you have" - " requested pattern %i\n", pattern); + " requested pattern %ld\n", pattern); pattern_set(0); return; } @@ -455,7 +455,7 @@ FUNCTION(_) { phase_angle_set(phase_angle - floor(phase_angle)); if (! (ph & old_ph)){ hall_error_set(1);} - if (pattern != (unsigned)old_pattern){hall_error_set(0);} + if (pattern != (rtapi_uint)old_pattern){hall_error_set(0);} if (force_trap) break; @@ -624,7 +624,7 @@ FUNCTION(_) { in_type_set(0x02); return; default: - rtapi_print_msg(RTAPI_MSG_ERR, "Unknown input type pattern (%X) in " + rtapi_print_msg(RTAPI_MSG_ERR, "Unknown input type pattern (%lX) in " "bldc\n", in_type); in_type_set(-2); return; @@ -781,7 +781,7 @@ FUNCTION(_) { out_type_set(0x400); return; default: - rtapi_print_msg(RTAPI_MSG_ERR, "Unsupported output type (%X) in bldc" + rtapi_print_msg(RTAPI_MSG_ERR, "Unsupported output type (%lX) in bldc" , out_type); in_type_set(-2); return; diff --git a/src/hal/components/boss_plc.c b/src/hal/components/boss_plc.c index 8b1016320b9..7098b9eb486 100644 --- a/src/hal/components/boss_plc.c +++ b/src/hal/components/boss_plc.c @@ -489,7 +489,7 @@ Plc_Export(Plc *this, int compId, int id) // Export functions. if(!error){ - error = hal_export_functf(Plc_Refresh, this, 1, 0, compId, "boss_plc.%d.refresh", id); + error = hal_export_functf(Plc_Refresh, this, 0, compId, "boss_plc.%d.refresh", id); } // Restore saved message level. diff --git a/src/hal/components/carousel.comp b/src/hal/components/carousel.comp index 354605f1d1f..32bcd11e8c9 100644 --- a/src/hal/components/carousel.comp +++ b/src/hal/components/carousel.comp @@ -101,7 +101,7 @@ at the completion of the tool search and at the same time the reverse duty/cycle velocity value will be sent to the motor-vel pin. """; -pin in si32 pocket-number """The pocket to move to when the .enable pin goes high. If the value +pin in sint pocket-number """The pocket to move to when the .enable pin goes high. If the value passed is higher than the number of pockets specified in the "pockets" modparam then modulo arithmetic is used. This is intended to allow the use of multiple tools in the same holder, as is sometimes useful with lathes."""; @@ -122,10 +122,10 @@ pin in real hold-dc "Duty cycle when carousel is in-position (to hold against s pin in real align-dc """Use this pin to set the speed of a slower alignment move once the changer is in position. Such a system almost certainly needs decel-time setting too"""; pin in real decel-time "Time to wait for carousel to stop before final alignment and position check"; -pin in si32 counts "Connect to the rawcounts of an encoder or a stepgen in 'counts' mode"; -pin in si32 scale = 100 "The number of stepgen or encoder counts between successive pockets"; -pin in si32 width = 10 "How far each side of the exact scale to signal a new pocket"; -pin in si32 home-offset = 0 "The offset (in counts) between the index and pocket 1"; +pin in sint counts "Connect to the rawcounts of an encoder or a stepgen in 'counts' mode"; +pin in sint scale = 100 "The number of stepgen or encoder counts between successive pockets"; +pin in sint width = 10 "How far each side of the exact scale to signal a new pocket"; +pin in sint home-offset = 0 "The offset (in counts) between the index and pocket 1"; pin io bool index-enable "Used to home to an encoder index"; pin in bool jog-fwd "Jog the carousel forwards one tool position"; pin in bool jog-rev """Jog the carousel in reverse (only if dir = 2). @@ -134,19 +134,19 @@ also be interlocked to only operate when the machine is idle."""; pin out bool motor-fwd "Indicates the motor should run forwards (bigger numbers)"; pin out bool motor-rev "Indicates the motor should run reverse."; pin out bool parity-error "Indicates a parity error"; -pin out si32 current-position "This pin indicates the current position feedback"; +pin out sint current-position "This pin indicates the current position feedback"; pin out real motor-vel "The duty-cycle or velocity to drive a DC motor or stepgen"; pin out bool homed = 0 "Shows that homing is complete. Only used in index and edge modes"; pin in bool unhome = 0 "Should only really be necessary for testing"; pin out real counts-target "Target position for a stepgen or external PID controller"; -param r si32 state = 0 "Current component state"; +param r sint state = 0 "Current component state"; param r bool homing = 0 "Shows that homing is in progress. Only used for index mode"; param r real timer "Shows the value of the internal timer"; -param r si32 motor-dir "Internal tag for search direction"; -param r si32 counts-offset "Internal offset of index pin"; -param rw ui32 debounce "How many thread cycles to wait for the position to stabilise"; -param r si32 target "Current target pocket, debug"; +param r sint motor-dir "Internal tag for search direction"; +param r sint counts-offset "Internal offset of index pin"; +param rw uint debounce "How many thread cycles to wait for the position to stabilise"; +param r sint target "Current target pocket, debug"; option count_function; option extra_setup; @@ -160,7 +160,7 @@ variable int inst_pockets; variable int inst_code; variable int inst_parity; variable int old_index = 0; -param r si32 base_counts = 0; +param r sint base_counts = 0; variable int old_unhome = 0; function _ ; @@ -194,10 +194,10 @@ RTAPI_MP_ARRAY_INT(parity, MAX_CHAN, "0 for even parity, 1 for odd") FUNCTION(_){ int i, d, pow; - static int deb = 0; + static rtapi_sint deb = 0; int pcalc = 0; - int mod_pocket = 0; - int new_pos = 0; + rtapi_sint mod_pocket = 0; + rtapi_sint new_pos = 0; unsigned int mask; int align_pin = 0; // used for slow align move, input depends on mode for historical reasons @@ -279,11 +279,11 @@ FUNCTION(_){ case 'C': // encoder or stepgen counts. new_pos = current_position; if (homed){ - int c; - int t; - int w = width / 2; + rtapi_sint c; + rtapi_sint t; + rtapi_sint w = width / 2; c = (counts - base_counts); - t = floor(((float)c + w) / scale); + t = floor(((rtapi_real)c + w) / scale); if (c >= (t * scale - w) && c <= (t * scale + w)) { new_pos = 1 + (t % inst_pockets); // C modulus of negative numbers is inconvenient diff --git a/src/hal/components/comp.comp b/src/hal/components/comp.comp index cf27ca469e0..8365df255fb 100644 --- a/src/hal/components/comp.comp +++ b/src/hal/components/comp.comp @@ -16,6 +16,7 @@ option period no; function _ "Update the comparator"; license "GPL"; author "Jeff Epler"; +see_also "conv_real_bool(9)."; ;; FUNCTION(_) { rtapi_real tmp = in1 - in0; diff --git a/src/hal/components/conv_real_bool.comp b/src/hal/components/conv_real_bool.comp new file mode 100644 index 00000000000..a00ee0d2dd7 --- /dev/null +++ b/src/hal/components/conv_real_bool.comp @@ -0,0 +1,23 @@ +component conv_real_bool """Convert a value from real to bool + +The output value `out` is False when `in` is within `±eps` of zero. +The `out` pin is set to True once the `in` value reaches beyond. + +* `in` < `-eps` -> `out` = True +* `in` > `+eps` -> `out` = True +* `-eps` ≤ `in` ≤ `+eps` -> `out` = False + +In effect: `out = |in| > |eps|` + +"""; +pin in real in "Input value to convert."; +pin out bool out "Output value is False when input is within ±eps."; +param rw real eps = 1e-8 "Epsilon value to determine the input to be zero."; +option period no; +function _ "Update 'out' based on 'in' to be within 'eps' or not."; +license "GPL"; +author "LinuxCNC authors"; +see_also "comp(9)."; +include ; +;; +out_set(fabs(in) > fabs(eps)); diff --git a/src/hal/components/counter.c b/src/hal/components/counter.c index d279c88db33..829d1412b89 100644 --- a/src/hal/components/counter.c +++ b/src/hal/components/counter.c @@ -147,7 +147,7 @@ int rtapi_app_main(void) } /* export functions */ retval = hal_export_funct("counter.update-counters", update, - counter_array, 0, 0, comp_id); + counter_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "COUNTER: ERROR: count funct export failed\n"); @@ -155,7 +155,7 @@ int rtapi_app_main(void) return -EIO; } retval = hal_export_funct("counter.capture-position", capture, - counter_array, 1, 0, comp_id); + counter_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "COUNTER: ERROR: capture funct export failed\n"); diff --git a/src/hal/components/dbounce.comp b/src/hal/components/dbounce.comp index f45355afe58..71eafe833a3 100644 --- a/src/hal/components/dbounce.comp +++ b/src/hal/components/dbounce.comp @@ -7,7 +7,7 @@ delay pins for each instance and supports *count*= or *names*= parameters pin in bool in; pin out bool out; -pin in ui32 delay = 5; +pin in uint delay = 5; variable unsigned state; option period no; diff --git a/src/hal/components/debounce.c b/src/hal/components/debounce.c index 57846146861..b8fe3d0ca4f 100644 --- a/src/hal/components/debounce.c +++ b/src/hal/components/debounce.c @@ -263,7 +263,7 @@ static int export_group(int num, debounce_group_t * addr, int group_size) return retval; } /* export function */ - retval = hal_export_functf(debounce, addr, 0, 0, comp_id, "debounce.%d", num); + retval = hal_export_functf(debounce, addr, 0, comp_id, "debounce.%d", num); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "DEBOUNCE: ERROR: 'debounce.%d' funct export failed\n", num); return -1; diff --git a/src/hal/components/demux.comp b/src/hal/components/demux.comp index 7d4c8d19067..47cbd6b2f31 100644 --- a/src/hal/components/demux.comp +++ b/src/hal/components/demux.comp @@ -11,7 +11,7 @@ parameter to true, in this case all bits up to the selected bit will be set, as might be required for an LED bargraph display."""; pin in bool sel-bit-## [5] "Binary-number bit selectors"; -pin in ui32 sel-u32 "Integer selection input"; +pin in uint sel-uint "Integer selection input"; pin out bool out-## [32:personality] "The set of output bits"; option default_personality 32; @@ -29,7 +29,7 @@ function _; FUNCTION(_){ int i, bit; - bit = sel_u32 + sel_bit(0) + (sel_bit(1) << 1) + (sel_bit(2) << 2) + bit = sel_uint + sel_bit(0) + (sel_bit(1) << 1) + (sel_bit(2) << 2) + (sel_bit(3) << 3) + (sel_bit(4) << 4); if (bit >= personality) bit = personality - 1; rtapi_bool bg = bargraph; diff --git a/src/hal/components/demux_generic.c b/src/hal/components/demux_generic.c index 7ce13958b44..1f400a1537c 100644 --- a/src/hal/components/demux_generic.c +++ b/src/hal/components/demux_generic.c @@ -62,8 +62,8 @@ RTAPI_MP_ARRAY_STRING(config, MAX_CHAN, "demux specifiers inNUMout"); int rtapi_app_main(void){ int retval; int i, f; - char hal_name[HAL_NAME_LEN]; - char *types[5] = {"invalid", "bit", "float", "s32", "u32"}; + char hal_name[HAL_NAME_LEN+1]; + static const char *types[HAL_TYPE_MAX] = {"invalid", "bool", "real", "sint", "uint", "port"}; if (!config[0]) { rtapi_print_msg(RTAPI_MSG_ERR, "The demux_generic component requires at least" " one valid format string\n"); @@ -122,11 +122,11 @@ int rtapi_app_main(void){ break; case 's': case 'S': - type = HAL_S32; + type = HAL_SINT; break; case 'u': case 'U': - type = HAL_U32; + type = HAL_UINT; break; default: rtapi_print_msg(RTAPI_MSG_ERR, "demux_generic: invalid character in " @@ -168,7 +168,7 @@ int rtapi_app_main(void){ // We did away with the no-fp thread. // Always export the float case. It can do any-to-any. - retval = hal_export_functf(write_fp, inst, 1, 0, comp_id, "demux-gen.%02i", i); + retval = hal_export_functf(write_fp, inst, 0, comp_id, "demux-gen.%02i", i); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "demux_generic: ERROR: function export" " failed\n"); @@ -198,17 +198,14 @@ int rtapi_app_main(void){ goto fail0; } - retval = rtapi_snprintf(hal_name, HAL_NAME_LEN, - "demux-gen.%02i.in-%s", i, types[inst->in_type]); - if (retval >= HAL_NAME_LEN) { + retval = rtapi_snprintf(hal_name, sizeof(hal_name), + "demux-gen.%02i.in-%s", i, types[inst->in_type]); + if (retval > HAL_NAME_LEN) { goto fail0; } switch(inst->in_type) { case HAL_BOOL: retval = hal_pin_new_bool(comp_id, HAL_IN, &inst->input.b, 0, "%s", hal_name); break; case HAL_REAL: retval = hal_pin_new_real(comp_id, HAL_IN, &inst->input.r, 0, "%s", hal_name); break; - case HAL_S32: retval = hal_pin_new_si32(comp_id, HAL_IN, &inst->input.s, 0, "%s", hal_name); break; - case HAL_U32: retval = hal_pin_new_ui32(comp_id, HAL_IN, &inst->input.u, 0, "%s", hal_name); break; - // FIXME: Future...when we switch types case HAL_SINT: retval = hal_pin_new_sint(comp_id, HAL_IN, &inst->input.s, 0, "%s", hal_name); break; case HAL_UINT: retval = hal_pin_new_uint(comp_id, HAL_IN, &inst->input.u, 0, "%s", hal_name); break; default: retval = -ENOENT; break; @@ -242,17 +239,14 @@ int rtapi_app_main(void){ //output pins inst->outputs = hal_malloc(inst->size * sizeof(*inst->outputs)); for (p = 0; p < inst->size; p++) { - retval = rtapi_snprintf(hal_name, HAL_NAME_LEN, - "demux-gen.%02i.out-%s-%02i", i, types[inst->out_type], p); - if (retval >= HAL_NAME_LEN) { + retval = rtapi_snprintf(hal_name, sizeof(hal_name), + "demux-gen.%02i.out-%s-%02i", i, types[inst->out_type], p); + if (retval > HAL_NAME_LEN) { goto fail0; } switch(inst->out_type) { case HAL_BOOL: retval = hal_pin_new_bool(comp_id, HAL_OUT, &inst->outputs[p].b, 0, "%s", hal_name); break; case HAL_REAL: retval = hal_pin_new_real(comp_id, HAL_OUT, &inst->outputs[p].r, 0, "%s", hal_name); break; - case HAL_S32: retval = hal_pin_new_si32(comp_id, HAL_OUT, &inst->outputs[p].s, 0, "%s", hal_name); break; - case HAL_U32: retval = hal_pin_new_ui32(comp_id, HAL_OUT, &inst->outputs[p].u, 0, "%s", hal_name); break; - // FIXME: Future...when we switch types case HAL_SINT: retval = hal_pin_new_sint(comp_id, HAL_OUT, &inst->outputs[p].s, 0, "%s", hal_name); break; case HAL_UINT: retval = hal_pin_new_uint(comp_id, HAL_OUT, &inst->outputs[p].u, 0, "%s", hal_name); break; default: retval = -ENOENT; break; @@ -261,7 +255,6 @@ int rtapi_app_main(void){ goto fail0; } } - } hal_ready(comp_id); @@ -307,15 +300,15 @@ void write_fp(void *arg, long period) { case FT(HAL_BOOL, HAL_BOOL): hal_set_bool(inst->outputs[s].b, hal_get_bool(inst->input.b)); break; - case FT(HAL_BOOL, HAL_S32): - hal_set_si32(inst->outputs[s].s, hal_get_bool(inst->input.b)); - break; - case FT(HAL_BOOL, HAL_U32): - hal_set_ui32(inst->outputs[s].u, hal_get_bool(inst->input.b)); - break; case FT(HAL_BOOL, HAL_REAL): hal_set_real(inst->outputs[s].r, hal_get_bool(inst->input.b) ? 1.0 : 0.0); break; + case FT(HAL_BOOL, HAL_SINT): + hal_set_sint(inst->outputs[s].s, hal_get_bool(inst->input.b)); + break; + case FT(HAL_BOOL, HAL_UINT): + hal_set_uint(inst->outputs[s].u, hal_get_bool(inst->input.b)); + break; case FT(HAL_REAL, HAL_BOOL): hal_set_bool(inst->outputs[s].b, fabs(hal_get_real(inst->input.r)) > EPS); @@ -323,53 +316,53 @@ void write_fp(void *arg, long period) { case FT(HAL_REAL, HAL_REAL): hal_set_real(inst->outputs[s].r, hal_get_real(inst->input.r)); break; - case FT(HAL_REAL, HAL_S32): { + case FT(HAL_REAL, HAL_SINT): { rtapi_real v = hal_get_real(inst->input.r); - if (v > RTAPI_INT32_MAX) { - hal_set_si32(inst->outputs[s].s, RTAPI_INT32_MAX); - } else if (v < RTAPI_INT32_MIN) { - hal_set_si32(inst->outputs[s].s, RTAPI_INT32_MIN); + if (v > (rtapi_real)RTAPI_SINT_MAX) { + hal_set_sint(inst->outputs[s].s, RTAPI_SINT_MAX); + } else if (v < (rtapi_real)RTAPI_SINT_MIN) { + hal_set_sint(inst->outputs[s].s, RTAPI_SINT_MIN); } else { - hal_set_si32(inst->outputs[s].s, v); + hal_set_sint(inst->outputs[s].s, v); } break; } - case FT(HAL_REAL, HAL_U32): { + case FT(HAL_REAL, HAL_UINT): { rtapi_real v = hal_get_real(inst->input.r); - if (v > RTAPI_UINT32_MAX) { - hal_set_ui32(inst->outputs[s].u, RTAPI_UINT32_MAX); - } else if (v < 0) { - hal_set_ui32(inst->outputs[s].u, 0); + if (v > (rtapi_real)RTAPI_UINT_MAX) { + hal_set_uint(inst->outputs[s].u, RTAPI_UINT_MAX); + } else if (v < 0.0) { + hal_set_uint(inst->outputs[s].u, 0); } else { - hal_set_ui32(inst->outputs[s].u, v); + hal_set_uint(inst->outputs[s].u, v); } break; } - case FT(HAL_S32, HAL_BOOL): - hal_set_bool(inst->outputs[s].b, hal_get_si32(inst->input.s) != 0); + case FT(HAL_SINT, HAL_BOOL): + hal_set_bool(inst->outputs[s].b, hal_get_sint(inst->input.s) != 0); break; - case FT(HAL_S32, HAL_S32): - hal_set_si32(inst->outputs[s].s, hal_get_si32(inst->input.s)); + case FT(HAL_SINT, HAL_REAL): + hal_set_real(inst->outputs[s].r, hal_get_sint(inst->input.s)); break; - case FT(HAL_S32, HAL_U32): { - rtapi_s32 v = hal_get_si32(inst->input.s); - hal_set_ui32(inst->outputs[s].u, v > 0 ? v : 0); - break; } - case FT(HAL_S32, HAL_REAL): - hal_set_real(inst->outputs[s].r, hal_get_si32(inst->input.s)); + case FT(HAL_SINT, HAL_SINT): + hal_set_sint(inst->outputs[s].s, hal_get_sint(inst->input.s)); break; + case FT(HAL_SINT, HAL_UINT): { + rtapi_sint v = hal_get_sint(inst->input.s); + hal_set_uint(inst->outputs[s].u, v > 0 ? v : 0); + break; } - case FT(HAL_U32, HAL_BIT): - hal_set_bool(inst->outputs[s].b, hal_get_ui32(inst->input.u) != 0); + case FT(HAL_UINT, HAL_BOOL): + hal_set_bool(inst->outputs[s].b, hal_get_uint(inst->input.u) != 0); break; - case FT(HAL_U32, HAL_S32): { - rtapi_u32 v = hal_get_ui32(inst->input.u); - hal_set_si32(inst->outputs[s].s, v > (rtapi_u32)RTAPI_INT32_MAX ? RTAPI_INT32_MAX : (rtapi_s32)v); - break; } - case FT(HAL_U32, HAL_U32): - hal_set_ui32(inst->outputs[s].u, hal_get_ui32(inst->input.u)); + case FT(HAL_UINT, HAL_REAL): + hal_set_real(inst->outputs[s].r, hal_get_uint(inst->input.u)); break; - case FT(HAL_U32, HAL_REAL): - hal_set_real(inst->outputs[s].r, hal_get_ui32(inst->input.u)); + case FT(HAL_UINT, HAL_SINT): { + rtapi_uint v = hal_get_uint(inst->input.u); + hal_set_sint(inst->outputs[s].s, v > RTAPI_SINT_MAX ? RTAPI_SINT_MAX : v); + break; } + case FT(HAL_UINT, HAL_UINT): + hal_set_uint(inst->outputs[s].u, hal_get_uint(inst->input.u)); break; } } diff --git a/src/hal/components/edge.comp b/src/hal/components/edge.comp index 42656188be9..a2ee2156d33 100644 --- a/src/hal/components/edge.comp +++ b/src/hal/components/edge.comp @@ -22,9 +22,9 @@ pin out bool out_invert "Goes low when the desired edge is seen on 'in'"; param rw bool both=FALSE "If TRUE, selects both edges. Otherwise, selects one edge according to in-edge"; param rw bool in_edge=TRUE "If both is FALSE, selects the one desired edge: TRUE means falling, FALSE means rising"; -param rw si32 out_width_ns=0 "Time in nanoseconds of the output pulse"; +param rw sint out_width_ns=0 "Time in nanoseconds of the output pulse"; -param r si32 time_left_ns "Time left in this output pulse"; +param r sint time_left_ns "Time left in this output pulse"; param r bool last_in "Previous input value"; variable int first = 1; @@ -34,15 +34,15 @@ author "Jeff Epler"; ;; FUNCTION(_){ - int new_in = in; - rtapi_s32 tlns = time_left_ns; + rtapi_bool new_in = in; + rtapi_sint tlns = time_left_ns; if (tlns > 0) { time_left_ns_set(tlns -= period); } if ( !first ) { - int rise = new_in && !last_in; - int fall = !new_in && last_in; - int desired_edge = + rtapi_bool rise = new_in && !last_in; + rtapi_bool fall = !new_in && last_in; + rtapi_bool desired_edge = both ? rise || fall : in_edge ? fall : rise; if(desired_edge) { diff --git a/src/hal/components/encoder.c b/src/hal/components/encoder.c index 1faf2948cf1..6cb08cf12c5 100644 --- a/src/hal/components/encoder.c +++ b/src/hal/components/encoder.c @@ -291,7 +291,7 @@ int rtapi_app_main(void) } /* export functions */ retval = hal_export_funct("encoder.update-counters", update, - counter_array, 0, 0, comp_id); + counter_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "ENCODER: ERROR: count funct export failed\n"); @@ -299,7 +299,7 @@ int rtapi_app_main(void) return -1; } retval = hal_export_funct("encoder.capture-position", capture, - counter_array, 1, 0, comp_id); + counter_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "ENCODER: ERROR: capture funct export failed\n"); diff --git a/src/hal/components/encoder_ratio.c b/src/hal/components/encoder_ratio.c index 3adf5c0ce07..6e2b65b7bca 100644 --- a/src/hal/components/encoder_ratio.c +++ b/src/hal/components/encoder_ratio.c @@ -244,7 +244,7 @@ int rtapi_app_main(void) } /* export functions */ retval = hal_export_funct("encoder-ratio.sample", sample, - encoder_pair_array, 0, 0, comp_id); + encoder_pair_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "ENCODER_RATIO: ERROR: sample funct export failed\n"); @@ -252,7 +252,7 @@ int rtapi_app_main(void) return -1; } retval = hal_export_funct("encoder-ratio.update", update, - encoder_pair_array, 1, 0, comp_id); + encoder_pair_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "ENCODER_RATIO: ERROR: update funct export failed\n"); diff --git a/src/hal/components/enum.c b/src/hal/components/enum.c index e6ecf728779..faa5acf676f 100644 --- a/src/hal/components/enum.c +++ b/src/hal/components/enum.c @@ -30,7 +30,7 @@ /* module information */ MODULE_AUTHOR("Andy Pugh"); -MODULE_DESCRIPTION("convert enumerated types to HAL_BIT pins"); +MODULE_DESCRIPTION("convert enumerated types to HAL_BOOL pins"); MODULE_LICENSE("GPL"); #define MAX_CHAN 256 @@ -162,9 +162,9 @@ int rtapi_app_main(void){ } } if (inst->dir == HAL_OUT){ - hal_export_funct(this, decode, inst, 0, 0, comp_id); + hal_export_funct(this, decode, inst, 0, comp_id); } else { - hal_export_funct(this, encode, inst, 0, 0, comp_id); + hal_export_funct(this, encode, inst, 0, comp_id); } if (retval < 0){ rtapi_print_msg(RTAPI_MSG_ERR, "Failed to export functions\n"); diff --git a/src/hal/components/eoffset_per_angle.comp b/src/hal/components/eoffset_per_angle.comp index aa0922c148b..85b302955e0 100644 --- a/src/hal/components/eoffset_per_angle.comp +++ b/src/hal/components/eoffset_per_angle.comp @@ -6,9 +6,9 @@ description An offset is computed (from one of several functions) based on an input angle in degrees. The angle could be a rotary coordinate value or a spindle angle. -The computed offset is represented as an s32 *kcounts* output pin that is a +The computed offset is represented as an integer *kcounts* output pin that is a compatible input to external offset pins like *axis.L.eoffset-counts* where *L* -is the coordinate letter. Scaling of the s32 *kcounts* is controlled by the +is the coordinate letter. Scaling of the integer *kcounts* is controlled by the input (*k*) -- its reciprocal value is presented on an output pin *kreciprocal* for connection to *axis.L.eoffset-scale*. The default value for *k* should be suitable for most uses. @@ -68,20 +68,20 @@ pin in bool enable_in = 0 "Enable Input"; pin in real radius_ref = 1 "Radius reference (see notes)"; pin in real angle = 0 "Input angle (in degrees)"; pin in real start_angle = 0 "Start angle (in degrees)"; -pin in si32 fnum = 0 "Function selector (default 0)"; +pin in sint fnum = 0 "Function selector (default 0)"; pin in real rfraction = 0.1 "Offset amplitude (+/- fraction of radius_ref)"; pin in real fmult = 6 "Offset frequency multiplier"; -pin in ui32 k = 10000 "Scaling Factor (if 0, use 10000)"; +pin in uint k = 10000 "Scaling Factor (if 0, use 10000)"; pin out bool is_off "invert is_on (for convenience)"; pin out bool enable_out "To: axis.L.eoffset-enable"; pin out bool clear "To: axis.L.eoffset-clear"; -pin out si32 kcounts "To: axis.L.eoffset-counts"; +pin out sint kcounts "To: axis.L.eoffset-counts"; pin out real kreciprocal "To: axis.L.eoffset-scale (1/k)"; pin out real eoffset_dbg "offset (debug pin--use kcounts & kreciprocal)"; -pin out ui32 state_dbg "state (debug pin)"; +pin out uint state_dbg "state (debug pin)"; //--------------------------------------------------------------------- // per-instance items: @@ -147,13 +147,13 @@ FUNCTION(_) { struct ofunc_data* dptr = &data; #define STATE dptr->thestate - int kfactor; + rtapi_uint kfactor; ofunc* thefunc; run_ct++; state_dbg_set(STATE); kfactor = k; - if (k == 0) {kfactor = 10000;} + if (kfactor == 0) {kfactor = 10000;} kreciprocal_set(1/((rtapi_real)kfactor)); is_off_set(!is_on); // convenience pin @@ -272,7 +272,7 @@ FUNCTION(_) { eoffset_dbg_set(0); STATE = STOPPING; rtapi_print_msg(RTAPI_MSG_ERR, - "eoffset_per_angle stopping:func%d problem\n",fnum); + "eoffset_per_angle stopping:func%ld problem\n",fnum); return; } diff --git a/src/hal/components/gray2bin.comp b/src/hal/components/gray2bin.comp index f5590fa02cb..c2562cc193d 100644 --- a/src/hal/components/gray2bin.comp +++ b/src/hal/components/gray2bin.comp @@ -1,14 +1,14 @@ component gray2bin "convert a gray-code input to binary"; description """Converts a gray-coded number into the corresponding binary value"""; -pin in ui32 in "gray code in"; -pin out ui32 out "binary code out"; +pin in uint in "gray code in"; +pin out uint out "binary code out"; license "GPL"; author "Andy Pugh"; function _; option period no; ;; -rtapi_u32 mask; -rtapi_u32 val = in; +rtapi_uint mask; +rtapi_uint val = in; for(mask = val >> 1 ; mask != 0 ; mask = mask >> 1){ val ^= mask; } diff --git a/src/hal/components/histobins.comp b/src/hal/components/histobins.comp index 2163467490b..ffea1d85c0e 100644 --- a/src/hal/components/histobins.comp +++ b/src/hal/components/histobins.comp @@ -44,18 +44,18 @@ The method input pin selects an alternate variance calculation. Maintainers note: hardcoded for MAXBINNUMBER==200 """; //" To make vim happy in syntax=c mode -pin in ui32 pintype; +pin in uint pintype; pin in real input; -pin in si32 input_s32; -pin in ui32 input_u32; +pin in sint input_s32; +pin in uint input_u32; pin in bool input_bit; -pin in ui32 nbins = 20; // must be < MAXBINNUMBER +pin in uint nbins = 20; // must be < MAXBINNUMBER pin in real binsize = 1; pin in real minvalue = 0; -pin in si32 index; // use s32 to avoid 0x hex display in hal -pin out si32 check; // use s32 to avoid 0x hex display in hal +pin in sint index; // use sint to avoid 0x hex display in hal +pin out sint check; // use sint to avoid 0x hex display in hal pin in bool reset; pin in bool method; @@ -66,19 +66,19 @@ pin out real nextra; pin out real input_min; pin out real input_max; -pin out ui32 nsamples; +pin out uint nsamples; pin out real variance; pin out real mean; // user may interrogate availablebins to determine this compiled-in limit -pin out si32 availablebins = 200; //MAXBINNUMBER +pin out sint availablebins = 200; //MAXBINNUMBER option period no; function _; -variable int bin[200]; // MAXBINNUMBER +variable rtapi_sint bin[200]; // MAXBINNUMBER variable int first = 1; -variable unsigned last_nbins = 0; +variable rtapi_uint last_nbins = 0; variable rtapi_real maxvalue; @@ -97,7 +97,7 @@ rtapi_real invalue; unsigned i; int idx; check_set(index); -if ( (nbins > (unsigned)availablebins) +if ( (nbins > (rtapi_uint)availablebins) || (nbins < 1) ) { input_error_set(1); @@ -152,7 +152,7 @@ check_set(index); // user should verify check==index for reading values // -1 value indicates illegal index if (index < 0) { binvalue_set(-1); -} else if (index < (int)nbins) { +} else if (index < (rtapi_sint)nbins) { binvalue_set(bin[index]); } else { binvalue_set(-1); diff --git a/src/hal/components/histobinstream.comp b/src/hal/components/histobinstream.comp index d4d682aadb8..7dd6d7230f4 100644 --- a/src/hal/components/histobinstream.comp +++ b/src/hal/components/histobinstream.comp @@ -46,13 +46,13 @@ Maintainers note: hardcoded for MAXBINNUMBER==200 """; // "} make vim syntax highligting happy -pin in ui32 pintype "Select the input pin (0:input 1:input-s32 2:input-u32 3:input-bit)."; +pin in uint pintype "Select the input pin (0:input 1:input-s32 2:input-u32 3:input-bit)."; pin in real input "Floating point input value (pintype 0)."; -pin in si32 input_s32 "Signed input value (pintype 1)."; -pin in ui32 input_u32 "Unsigned input value (pintype 2)."; +pin in sint input_s32 "Signed input value (pintype 1)."; +pin in uint input_u32 "Unsigned input value (pintype 2)."; pin in bool input_bit "Bit input value (pintype 3)."; -pin in ui32 nbins = 20 "Number of active bins N (0 ... N-1)."; +pin in uint nbins = 20 "Number of active bins N (0 ... N-1)."; pin in real binsize = 1 "Width of one bin in input units."; pin in real minvalue = 0 "Lower edge of bin 0."; @@ -65,13 +65,13 @@ pin out bool input_error "Set when input rules are violated; updates are invali pin out real input_min "Minimum input value seen (latched on stream rising edge)."; pin out real input_max "Maximum input value seen (latched on stream rising edge)."; -pin out ui32 nsamples "Number of samples accumulated (latched on stream rising edge)."; +pin out uint nsamples "Number of samples accumulated (latched on stream rising edge)."; pin out real variance "Variance of the input (latched on stream rising edge)."; pin out real mean "Mean of the input (latched on stream rising edge)."; pin out sint stream_time "The time it took for the stream data to be pushed out in nanoseconds (ns)."; // user may interrogate availablebins to determine this compiled-in limit -pin out si32 availablebins = 200; //MAXBINNUMBER +pin out sint availablebins = 200; //MAXBINNUMBER option period no; function _; @@ -82,7 +82,7 @@ include ; include ; variable int first = 1; -variable unsigned last_nbins = 0; +variable rtapi_uint last_nbins = 0; variable rtapi_real last_binsize = 0; variable rtapi_real last_minvalue = 0; variable rtapi_real maxvalue = 0; @@ -91,7 +91,7 @@ variable hal_stream_data_u bins[200]; // MAXBINNUMBER variable hal_stream_data_u ptail; // count of inputs >= upper edge variable hal_stream_data_u ntail; // count of inputs < minvalue -variable rtapi_u64 run_nsamples = 0; +variable rtapi_uint run_nsamples = 0; variable rtapi_real run_min = 1e99; variable rtapi_real run_max = -1e99; variable rtapi_real run_mean = 0; @@ -134,7 +134,7 @@ FUNCTION(_) { rtapi_s64 now = rtapi_get_time(); // Cache some pins - rtapi_u32 c_nbins= nbins; + rtapi_uint c_nbins = nbins; rtapi_real c_binsize = binsize; rtapi_real c_minvalue = minvalue; @@ -150,7 +150,7 @@ FUNCTION(_) { // Validate the requested bin geometry. binsize must be > 0 to avoid a // divide by zero and to keep the bin index monotonic. - if (c_nbins < 1 || c_nbins > (unsigned)availablebins || c_binsize <= 0.0) { + if (c_nbins < 1 || c_nbins > (rtapi_uint)availablebins || c_binsize <= 0.0) { input_error_set(1); last_stream = stream; // do not act on a stream edge while in error return; diff --git a/src/hal/components/knob2float.comp b/src/hal/components/knob2float.comp index 1e19f38503c..76d990c32d7 100644 --- a/src/hal/components/knob2float.comp +++ b/src/hal/components/knob2float.comp @@ -17,7 +17,7 @@ component knob2float "Convert counts (probably from an encoder) to a float value"; -pin in si32 counts "Counts"; +pin in sint counts "Counts"; pin in bool enable "When TRUE, output is controlled by count, when FALSE, output is fixed"; pin in real scale "Amount of output change per count"; pin out real out "Output value"; @@ -34,12 +34,12 @@ author "John Kasunich"; ;; typedef struct { - long old_counts; + rtapi_sint old_counts; rtapi_real old_out; } knob2float_data; FUNCTION(_) { - long delta_counts; + rtapi_sint delta_counts; rtapi_real tmp_out; if ( min_out > max_out ) { diff --git a/src/hal/components/latencybins.comp b/src/hal/components/latencybins.comp index 78a75e104ee..dd3cb0dec8e 100644 --- a/src/hal/components/latencybins.comp +++ b/src/hal/components/latencybins.comp @@ -34,45 +34,42 @@ The latency pin outputs the instantaneous latency. Maintainers note: hardcoded for MAXBINNUMBER==1000 """; -pin in si32 maxbinnumber = 1000; // MAXBINNUMBER -pin in si32 index; //use s32 to avoid 0x hex display in hal +pin in sint maxbinnumber = 1000; // MAXBINNUMBER +pin in sint index; //use sint to avoid 0x hex display in hal pin in bool reset; -pin in si32 nsbinsize; - -pin out si32 check; -pin out si32 latency; -pin out si32 latency_max; -pin out si32 latency_min; -pin out si32 pbinvalue; -pin out si32 nbinvalue; -pin out si32 pextra; -pin out si32 nextra; -pin out si32 variance; +pin in sint nsbinsize; + +pin out sint check; +pin out sint latency; +pin out sint latency_max; +pin out sint latency_min; +pin out sint pbinvalue; +pin out sint nbinvalue; +pin out sint pextra; +pin out sint nextra; +pin out sint variance; // user may interrogate available bins to determine this compiled-in limit -pin out si32 availablebins = 1000; // MAXBINNUMBER +pin out sint availablebins = 1000; // MAXBINNUMBER function _; -variable rtapi_s64 last_timer = 0; -variable int last_binmax = 0; +variable rtapi_sint last_timer = 0; +variable rtapi_sint last_binmax = 0; variable int first = 1; -variable int pbins[1001]; // MAXBINNUMBER+1 -variable int nbins[1001]; // MAXBINNUMBER+1 -variable int binmax = 0; +variable rtapi_sint pbins[1001]; // MAXBINNUMBER+1 +variable rtapi_sint nbins[1001]; // MAXBINNUMBER+1 +variable rtapi_sint binmax = 0; -variable rtapi_u32 nsamples; -variable rtapi_u64 sum; -variable rtapi_u64 sq_sum; +variable rtapi_uint nsamples; +variable rtapi_uint sum; +variable rtapi_uint sq_sum; license "GPL"; author "Dewey Garrett"; ;; -rtapi_s64 now = rtapi_get_time(); -rtapi_s32 lat32 = (rtapi_s32)(now - last_timer - period); - //(2^31-1)*1nS = 2.147 seconds max - -int i; +rtapi_sint now = rtapi_get_time(); +rtapi_sint lat = (rtapi_sint)(now - last_timer - period); last_timer = now; @@ -88,21 +85,21 @@ if ( first ) { first = 0; latency_set(0); - latency_min_set(0x7FFFFFFF); - latency_max_set(0x80000000); + latency_min_set(RTAPI_SINT_MAX); + latency_max_set(RTAPI_SINT_MIN); pextra_set(0); nextra_set(0); - for (i = 0; i <= binmax; i++) { + for (int i = 0; i <= binmax; i++) { pbins[i] = 0; nbins[i] = 0; } nsamples = 0; sum = 0; sq_sum = 0; } else { - latency_set(lat32); - i = lat32/nsbinsize; - if (lat32 > latency_max) latency_max_set(lat32); - if (lat32 < latency_min) latency_min_set(lat32); + latency_set(lat); + rtapi_sint i = lat/nsbinsize; + if (lat > latency_max) latency_max_set(lat); + if (lat < latency_min) latency_min_set(lat); if (i >= 0) { if (i > binmax) { pextra_set(pextra + 1); @@ -118,8 +115,8 @@ if ( first } } nsamples++; - sum += lat32; - sq_sum += lat32 * lat32; + sum += lat; + sq_sum += lat * lat; if (nsamples > 1) { // note: division required is: u64/u32 rtapi_u64 dividend; diff --git a/src/hal/components/lcd.c b/src/hal/components/lcd.c index 11db13bc279..6c07c263a01 100644 --- a/src/hal/components/lcd.c +++ b/src/hal/components/lcd.c @@ -200,7 +200,7 @@ int rtapi_app_main(void){ } } } - retval = hal_export_funct("lcd", write, lcd, 1, 0, comp_id); //needs fp? + retval = hal_export_funct("lcd", write, lcd, 0, comp_id); //needs fp? if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "LCD: ERROR: function export failed\n"); return -1; diff --git a/src/hal/components/limit3.comp b/src/hal/components/limit3.comp index c1ea302eb5e..f0d79ea02e0 100644 --- a/src/hal/components/limit3.comp +++ b/src/hal/components/limit3.comp @@ -14,7 +14,7 @@ pin in real max_=1e20; pin in real maxv=1e20; pin in real maxa=1e7 """Max Acceleration. Note that the component becomes unstable with maxa greater than about 1e7 in a 1kHz thread"""; -pin in ui32 smooth_steps=2 +pin in uint smooth_steps=2 """Smooth out acceleration this many periods before reaching input or max/min limit. Higher values avoid oscillation, but will accelerate slightly more slowly."""; diff --git a/src/hal/components/limit_axis.comp b/src/hal/components/limit_axis.comp index f2458264799..b24009455be 100644 --- a/src/hal/components/limit_axis.comp +++ b/src/hal/components/limit_axis.comp @@ -46,7 +46,7 @@ pin out bool error-no-range "error pin indicating that no range matches the fb"; pin out real min-output "Minimum limit output"; pin out real max-output "Maximum limit output"; pin in real fb "Feedback pin, the value of this pin determines which range is active"; -pin out ui32 current-range "Indicates which range is currently active"; +pin out uint current-range "Indicates which range is currently active"; pin in real min-limit-## [10:personality] "The array of minimum limits to select from"; pin in real max-limit-## [10:personality] "The array of macimum limits"; pin in real min-range-## [10:personality] "Defines the range of values with which the fb is compared to set the range"; @@ -115,7 +115,7 @@ FUNCTION(_){ min_output_set(min_limit(i)); // Found our limits, stop looking error_no_range_set(0); - if (i != (int)current_range){ + if ((rtapi_uint)i != current_range){ rtapi_print_msg(RTAPI_MSG_INFO, "limit_axis: Switching to Range %d\n", i); current_range_set(i); } diff --git a/src/hal/components/matrix_kb.c b/src/hal/components/matrix_kb.c index 25e305d1c62..1d49516ee09 100644 --- a/src/hal/components/matrix_kb.c +++ b/src/hal/components/matrix_kb.c @@ -338,7 +338,7 @@ int rtapi_app_main(void){ } } - retval = hal_export_funct(inst->name, loop, inst, 1, 0, comp_id); //needs fp? + retval = hal_export_funct(inst->name, loop, inst, 0, comp_id); //needs fp? if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "matrix_kb: ERROR: function export failed\n"); return -1; diff --git a/src/hal/components/max31855.comp b/src/hal/components/max31855.comp index 2421378072a..324b42fd0cd 100644 --- a/src/hal/components/max31855.comp +++ b/src/hal/components/max31855.comp @@ -37,7 +37,7 @@ pin out real temp_fahrenheit.# [15 : (personality & 0xf)] """Temperature in Fahr pin out real temp_kelvin.# [15 : (personality & 0xf)] """Temperature in Kelvin."""; pin out bool fault.# [15 : (personality & 0xf)] "Fault condition detected."; -pin out ui32 fault_flags.# [15 : (personality & 0xf)] "Fault flags: 0x1 = open sensor, 0x2 short to gnd, 0x3 short to vcc."; +pin out uint fault_flags.# [15 : (personality & 0xf)] "Fault flags: 0x1 = open sensor, 0x2 short to gnd, 0x3 short to vcc."; variable unsigned data_frame [15]; variable unsigned state = 1; diff --git a/src/hal/components/mesa_pktgyro_test.comp b/src/hal/components/mesa_pktgyro_test.comp index 0dffa30f172..f9c8dae103a 100644 --- a/src/hal/components/mesa_pktgyro_test.comp +++ b/src/hal/components/mesa_pktgyro_test.comp @@ -51,7 +51,7 @@ include ; include "hal/drivers/mesa-hostmot2/hostmot2.h"; -pin out si32 rxbytes "Number of Bytes received or negative Error code"; +pin out sint rxbytes "Number of Bytes received or negative Error code"; variable char *name; // PktUART name diff --git a/src/hal/components/millturn.comp b/src/hal/components/millturn.comp index dbf18cd3a1c..f1aa680e45e 100644 --- a/src/hal/components/millturn.comp +++ b/src/hal/components/millturn.comp @@ -28,7 +28,7 @@ chapter (docs/src/motion/switchkins.txt) """; // The fpin pin is not accessible in kinematics functions. // Use the *_setup() function for pins and params used by kinematics. -pin out si32 fpin=0"pin to demonstrate use of a conventional (non-kinematics) function fdemo"; +pin out sint fpin=0"pin to demonstrate use of a conventional (non-kinematics) function fdemo"; option period no; function fdemo; license "GPL"; diff --git a/src/hal/components/mkconv.sh b/src/hal/components/mkconv.sh index b61e2f3dd2a..038aa257c81 100644 --- a/src/hal/components/mkconv.sh +++ b/src/hal/components/mkconv.sh @@ -9,12 +9,10 @@ fi # Convert the hal type into the underlying type utype() { case "$1" in - "bit") echo "rtapi_bool" ;; - "s32") echo "rtapi_s32" ;; - "u32") echo "rtapi_u32" ;; - "s64") echo "rtapi_sint" ;; - "u64") echo "rtapi_uint" ;; - "float") echo "rtapi_real" ;; + "bool") echo "rtapi_bool" ;; + "sint") echo "rtapi_sint" ;; + "uint") echo "rtapi_uint" ;; + "real") echo "rtapi_real" ;; *) echo "This_Will_Generate_An_Error" ;; esac } @@ -22,12 +20,10 @@ utype() { # Return the maximum value supported by a type maxval() { case "$1" in - "bit") echo "1" ;; - "s32") echo "RTAPI_INT32_MAX" ;; - "u32") echo "RTAPI_UINT32_MAX" ;; - "s64") echo "RTAPI_INT64_MAX" ;; - "u64") echo "RTAPI_UINT64_MAX" ;; - "float") echo "Never_Used" ;; + "bool") echo "1" ;; + "sint") echo "RTAPI_SINT_MAX" ;; + "uint") echo "RTAPI_UINT_MAX" ;; + "real") echo "Never_Used" ;; *) echo "This_Will_Generate_An_Error" ;; esac } @@ -35,12 +31,10 @@ maxval() { # Return the minimum value supported by a type minval() { case "$1" in - "bit") echo "0" ;; - "s32") echo "RTAPI_INT32_MIN" ;; - "u32") echo "0" ;; - "s64") echo "RTAPI_INT64_MIN" ;; - "u64") echo "0" ;; - "float") echo "Never_Used" ;; + "bool") echo "0" ;; + "sint") echo "RTAPI_SINT_MIN" ;; + "uint") echo "0" ;; + "real") echo "Never_Used" ;; *) echo "This_Will_Generate_An_Error" ;; esac } @@ -48,12 +42,10 @@ minval() { # New HAL types _newtype() { case "$1" in - "bit") echo "bool" ;; - "s32") echo "si32" ;; - "u32") echo "ui32" ;; - "s64") echo "sint" ;; - "u64") echo "uint" ;; - "float") echo "real" ;; + "bool") echo "bool" ;; + "sint") echo "sint" ;; + "uint") echo "uint" ;; + "real") echo "real" ;; *) echo "This_Will_Generate_An_Error" ;; esac } @@ -64,48 +56,42 @@ _newtype() { # + = max side bound needed # - = min side bound needed # (table: vertical=from ($1); horizontal=to ($2)) -# | flt | u32 | s32 | u64 | s64 | bit -# ----+-----+-----+-----+-----+-----+----- -# flt | xxx | +- | +- | +- | +- | xxx -# u32 | o | xxx | + | o | o | + -# s32 | o | - | xxx | - | o | +- -# u64 | o | + | + | xxx | + | + -# s64 | o | +- | +- | - | xxx | +- -# bit | o | o | o | o | o | xxx +# | real | uint | sint | bool +# -----+------+------+------+------ +# real | xxx | +- | +- | xxx +# uint | o | xxx | + | + +# sint | o | - | xxx | +- +# bool | o | o | o | xxx # # Boolean implementation of the above table: -# | flt | u32 | s32 | u64 | s64 | bit -# ----+-----+-----+-----+-----+-----+----- -# flt | o+- | +- | +- | +- | +- | x+- -# u32 | o | xxx | + | o | o | + -# s32 | o | - | x+x | - | o | +- -# u64 | o | + | + | x+x | + | + -# s64 | o | +- | +- | - | xx- | +- -# bit | o | o | o | o | o | o+x +# | real | uint | sint | bool +# -----+------+------+------+------ +# real | o+- | +- | +- | x+- +# uint | o | x+x | + | + +# sint | o | - | xx- | +- +# bool | o | o | o | o+x # # Enable (val > MAX) test V=1 -test "$1" = 'float' -o \ - "$2" = 'bit' -o \ - \( "$2" = 's32' -a "$1" != 'bit' \) -o \ - \( "$1" = 'u64' -a "$2" != 'float' \) -o \ - \( "$1" = 's64' -a "$2" = 'u32' \) && V=0 +test "$1" = 'real' -o \ + "$2" = 'bool' -o \ + \( "$1" = 'uint' -a "$2" != 'real' \) && V=0 MAXEN="s,@MAXEN@,$V,g" # Enable (val < MIN) test V=1 -test "$1" = 'float' -o \ - \( "$1" = 's64' -a "$2" != 'float' \) -o \ - \( "$1" = 's32' -a \( "$2" = 'u32' -o "$2" = 'u64' -o "$2" = 'bit' \) \) && V=0 +test "$1" = 'real' -o \ + \( "$1" = 'sint' -a "$2" != 'real' \) && V=0 MINEN="s,@MINEN@,$V,g" # Disable clamp code -if test "$2" = 'float' -o \ - "$1" = 'bit' -o \ - \( "$1" = 'u32' -a \( "$2" = 'u64' -o "$2" = 's64' \) \) -o \ - \( "$1" = 's32' -a "$2" = 's64' \) -then CC="s,@CC@,//,g"; else CC="s,@CC@,,g"; fi +if test "$2" = 'real' -o \ + "$1" = 'bool'; then + CC="s,@CC@,//,g" +else + CC="s,@CC@,,g" +fi XIN="s,@XIN@,${1},g" XOUT="s,@XOUT@,${2},g" diff --git a/src/hal/components/modmath.c b/src/hal/components/modmath.c index aeb089e49ad..c24ca3608e2 100644 --- a/src/hal/components/modmath.c +++ b/src/hal/components/modmath.c @@ -196,7 +196,7 @@ static int export_mod_dir(int num) CHK(hal_pin_new_bool(comp_id, HAL_IO, &(moddir->wrap), 1, "%s.wrap", base), "wrap"); /* export function */ - retval = hal_export_funct(base, mod_dir_funct, moddir, 1, 0, comp_id); + retval = hal_export_funct(base, mod_dir_funct, moddir, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "MODMATH: ERROR: '%s' funct export failed\n", base); return -1; diff --git a/src/hal/components/momentary2nist.comp b/src/hal/components/momentary2nist.comp index 420c114e481..76b408d8ea1 100644 --- a/src/hal/components/momentary2nist.comp +++ b/src/hal/components/momentary2nist.comp @@ -29,12 +29,12 @@ is-on: └─────────────────┘ pin in bool in "momentary button in"; pin in bool is_on "current state of device"; -pin in ui32 debounce = 2 "debounce delay for 'in'-pin in cycles"; -pin in ui32 max_pulse_length = 100 "max output pulse length"; +pin in uint debounce = 2 "debounce delay for 'in'-pin in cycles"; +pin in uint max_pulse_length = 100 "max output pulse length"; pin out bool on "turn device on"; pin out bool off "turn device off"; -variable unsigned debounce_cntr; -variable unsigned pulse_length; +variable rtapi_uint debounce_cntr; +variable rtapi_uint pulse_length; variable bool state; option period no; diff --git a/src/hal/components/moveoff.comp b/src/hal/components/moveoff.comp index 3f6962d3a1f..494aa30ac35 100644 --- a/src/hal/components/moveoff.comp +++ b/src/hal/components/moveoff.comp @@ -105,8 +105,8 @@ pin in real waypoint-sample-secs = 0.02 "Minimum sample interval (in seconds) f pin out bool warning "Set TRUE if apply-offsets is deasserted while offset-applied is TRUE."; pin out bool offset_applied "TRUE if one or more offsets are applied."; pin out bool waypoint-limit = 0 "Indicates waypoint limit reached (motion ceases), an enabling pin must be deasserted to initiate return to original position."; -pin out si32 waypoint-ct "Waypoint count (for debugging)"; -pin out si32 waypoint-percent-used "Percent of available waypoints used"; +pin out sint waypoint-ct "Waypoint count (for debugging)"; +pin out sint waypoint-percent-used "Percent of available waypoints used"; pin in real offset-in-#[9 : personality] "Joint offset input value"; pin in real pos-#[9 : personality] "Joint position (typ: axis.0.motor-pos-cmd)"; @@ -125,7 +125,7 @@ pin in real offset-max-#[9 : personality] = 1e20 "Maximum limit for applied off pin in bool dbg_waypoint_limit_test "Debug input to test with limited number of waypoints"; // outputs for debugging: -pin out si32 dbg_state "Debug output for current state of state machine"; +pin out sint dbg_state "Debug output for current state of state machine"; option personality; option extra_setup; diff --git a/src/hal/components/multiclick.comp b/src/hal/components/multiclick.comp index f4de1ab293e..5f2ca65b4ca 100644 --- a/src/hal/components/multiclick.comp +++ b/src/hal/components/multiclick.comp @@ -56,27 +56,27 @@ pin and no fifth click followed it."""; // for debugging -pin out si32 state; +pin out sint state; param rw bool invert_input = FALSE """If FALSE (the default), clicks start with rising edges. If TRUE, clicks start with falling edges."""; -param rw ui32 max_hold_ns = 250000000 +param rw uint max_hold_ns = 250000000 """If the input is held down longer than this, it's not part of a multi-click. (Default 250,000,000 ns, 250 ms.)"""; -param rw ui32 max_space_ns = 250000000 +param rw uint max_space_ns = 250000000 """If the input is released longer than this, it's not part of a multi-click. (Default 250,000,000 ns, 250 ms.)"""; -param rw ui32 output_hold_ns = 100000000 +param rw uint output_hold_ns = 100000000 """Positive pulses on the output pins last this long. (Default 100,000,000 ns, 100 ms.)"""; -variable int click_state = 0; // wish i could have an enum type here +variable rtapi_sint click_state = 0; // wish i could have an enum type here // @@ -88,8 +88,8 @@ variable int click_state = 0; // wish i could have an enum type here // exceeds the timeout, the state machine resets. // -variable unsigned timer; -variable unsigned timeout; +variable rtapi_uint timer; +variable rtapi_uint timeout; // @@ -104,17 +104,17 @@ variable unsigned timeout; // X+1 click). // -variable unsigned single_click_hold_timer; -variable unsigned single_click_only_hold_timer; +variable rtapi_sint single_click_hold_timer; +variable rtapi_sint single_click_only_hold_timer; -variable unsigned double_click_hold_timer; -variable unsigned double_click_only_hold_timer; +variable rtapi_sint double_click_hold_timer; +variable rtapi_sint double_click_only_hold_timer; -variable unsigned triple_click_hold_timer; -variable unsigned triple_click_only_hold_timer; +variable rtapi_sint triple_click_hold_timer; +variable rtapi_sint triple_click_only_hold_timer; -variable unsigned quadruple_click_hold_timer; -variable unsigned quadruple_click_only_hold_timer; +variable rtapi_sint quadruple_click_hold_timer; +variable rtapi_sint quadruple_click_only_hold_timer; description """A click is defined as a rising edge on the 'in' pin, diff --git a/src/hal/components/multiswitch.comp b/src/hal/components/multiswitch.comp index e1f2eae4c40..78d8b24b87f 100644 --- a/src/hal/components/multiswitch.comp +++ b/src/hal/components/multiswitch.comp @@ -25,8 +25,8 @@ component multiswitch """This component toggles between a specified nu pin in bool up = false "Receives signal to toggle up"; pin in bool down = false "Receives signal to toggle down"; -param rw ui32 top-position "Number of positions"; -param rw si32 position "Current state (may be set in the HAL)"; +param rw uint top-position "Number of positions"; +param rw sint position "Current state (may be set in the HAL)"; pin out bool bit-##[32:personality] = false "Output bits"; diff --git a/src/hal/components/mux16.comp b/src/hal/components/mux16.comp index c62392dee09..9ceb7a6b5fe 100644 --- a/src/hal/components/mux16.comp +++ b/src/hal/components/mux16.comp @@ -18,10 +18,10 @@ pin in bool sel#[4] """\ Together, these determine which **in**__N__ value is copied to *out*. """; pin out real out_f; -pin out si32 out_s """\ +pin out sint out_s """\ Follows the value of one of the **in**__N__ values according to the four *sel* values and whether use-graycode is active. -The s32 value will be trunuated and limited to the max and min values of signed values. +The integer value will be trunuated and limited to the max and min values of signed values. [cols="^1,^1,^1,^1,1"] |=== @@ -51,7 +51,7 @@ The s32 value will be trunuated and limited to the max and min values of signed """; param r real elapsed "Current value of the internal debounce timer for debugging."; -param r si32 selected "Current value of the internal selection variable after conversion for debugging"; +param r sint selected "Current value of the internal selection variable after conversion for debugging"; pin in real in##[16] "array of selectable outputs"; variable rtapi_real delaytime; variable int lastnum; diff --git a/src/hal/components/mux_generic.c b/src/hal/components/mux_generic.c index a5515e3633b..4ccab7327f5 100644 --- a/src/hal/components/mux_generic.c +++ b/src/hal/components/mux_generic.c @@ -62,8 +62,8 @@ RTAPI_MP_ARRAY_STRING(config, MAX_CHAN, "mux specifiers inNUMout"); int rtapi_app_main(void){ int retval; int i, f; - char hal_name[HAL_NAME_LEN]; - char *types[5] = {"invalid", "bit", "float", "s32", "u32"}; + char hal_name[HAL_NAME_LEN+1]; + static const char *types[HAL_TYPE_MAX] = {"invalid", "bool", "real", "sint", "uint", "port"}; if (!config[0]) { rtapi_print_msg(RTAPI_MSG_ERR, "The mux_generic component requires at least" " one valid format string\n"); @@ -122,11 +122,11 @@ int rtapi_app_main(void){ break; case 's': case 'S': - type = HAL_S32; + type = HAL_SINT; break; case 'u': case 'U': - type = HAL_U32; + type = HAL_UINT; break; default: rtapi_print_msg(RTAPI_MSG_ERR, "mux_generic: invalid character in " @@ -168,7 +168,7 @@ int rtapi_app_main(void){ // We did away with the no-fp thread. // Always export the float case. It can do any-to-any. - retval = hal_export_functf(write_fp, inst, 1, 0, comp_id, "mux-gen.%02i", i); + retval = hal_export_functf(write_fp, inst, 0, comp_id, "mux-gen.%02i", i); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "mux_generic: ERROR: function export" " failed\n"); @@ -209,9 +209,6 @@ int rtapi_app_main(void){ switch(inst->in_type) { case HAL_BOOL: retval = hal_pin_new_bool(comp_id, HAL_IN, &inst->inputs[p].b, 0, "%s", hal_name); break; case HAL_REAL: retval = hal_pin_new_real(comp_id, HAL_IN, &inst->inputs[p].r, 0, "%s", hal_name); break; - case HAL_S32: retval = hal_pin_new_si32(comp_id, HAL_IN, &inst->inputs[p].s, 0, "%s", hal_name); break; - case HAL_U32: retval = hal_pin_new_ui32(comp_id, HAL_IN, &inst->inputs[p].u, 0, "%s", hal_name); break; - // FIXME: Future...when we switch types case HAL_SINT: retval = hal_pin_new_sint(comp_id, HAL_IN, &inst->inputs[p].s, 0, "%s", hal_name); break; case HAL_UINT: retval = hal_pin_new_uint(comp_id, HAL_IN, &inst->inputs[p].u, 0, "%s", hal_name); break; default: retval = -ENOENT; break; @@ -244,17 +241,14 @@ int rtapi_app_main(void){ } //output pins - retval = rtapi_snprintf(hal_name, HAL_NAME_LEN, - "mux-gen.%02i.out-%s", i, types[inst->out_type]); - if (retval >= HAL_NAME_LEN) { + retval = rtapi_snprintf(hal_name, sizeof(hal_name), + "mux-gen.%02i.out-%s", i, types[inst->out_type]); + if (retval > HAL_NAME_LEN) { goto fail0; } switch(inst->out_type) { case HAL_BOOL: retval = hal_pin_new_bool(comp_id, HAL_OUT, &inst->output.b, 0, "%s", hal_name); break; case HAL_REAL: retval = hal_pin_new_real(comp_id, HAL_OUT, &inst->output.r, 0, "%s", hal_name); break; - case HAL_S32: retval = hal_pin_new_si32(comp_id, HAL_OUT, &inst->output.s, 0, "%s", hal_name); break; - case HAL_U32: retval = hal_pin_new_ui32(comp_id, HAL_OUT, &inst->output.u, 0, "%s", hal_name); break; - // FIXME: Future...when we switch types case HAL_SINT: retval = hal_pin_new_sint(comp_id, HAL_OUT, &inst->output.s, 0, "%s", hal_name); break; case HAL_UINT: retval = hal_pin_new_uint(comp_id, HAL_OUT, &inst->output.u, 0, "%s", hal_name); break; default: retval = -ENOENT; break; @@ -262,7 +256,6 @@ int rtapi_app_main(void){ if (retval != 0) { goto fail0; } - } hal_ready(comp_id); @@ -307,11 +300,11 @@ void write_fp(void *arg, long period) { case FT(HAL_BOOL, HAL_BOOL): hal_set_bool(inst->output.b, hal_get_bool(inst->inputs[s].b)); break; - case FT(HAL_BOOL, HAL_S32): - hal_set_si32(inst->output.s, hal_get_bool(inst->inputs[s].b)); + case FT(HAL_BOOL, HAL_SINT): + hal_set_sint(inst->output.s, hal_get_bool(inst->inputs[s].b)); break; - case FT(HAL_BOOL, HAL_U32): - hal_set_ui32(inst->output.u, hal_get_bool(inst->inputs[s].b)); + case FT(HAL_BOOL, HAL_UINT): + hal_set_uint(inst->output.u, hal_get_bool(inst->inputs[s].b)); break; case FT(HAL_BOOL, HAL_REAL): hal_set_real(inst->output.r, hal_get_bool(inst->inputs[s].b) ? 1.0 : 0.0); @@ -320,56 +313,56 @@ void write_fp(void *arg, long period) { case FT(HAL_REAL, HAL_BOOL): hal_set_bool(inst->output.b, fabs(hal_get_real(inst->inputs[s].r)) > EPS); break; - case FT(HAL_REAL, HAL_REAL): - hal_set_real(inst->output.r, hal_get_real(inst->inputs[s].r)); - break; - case FT(HAL_REAL, HAL_S32): { + case FT(HAL_REAL, HAL_SINT): { rtapi_real v = hal_get_real(inst->inputs[s].r); - if (v > RTAPI_INT32_MAX) { - hal_set_si32(inst->output.s, RTAPI_INT32_MAX); - } else if (v < RTAPI_INT32_MIN) { - hal_set_si32(inst->output.s, RTAPI_INT32_MIN); + if (v > (rtapi_real)RTAPI_SINT_MAX) { + hal_set_sint(inst->output.s, RTAPI_SINT_MAX); + } else if (v < (rtapi_real)RTAPI_SINT_MIN) { + hal_set_sint(inst->output.s, RTAPI_SINT_MIN); } else { - hal_set_si32(inst->output.s, v); + hal_set_sint(inst->output.s, v); } break; } - case FT(HAL_REAL, HAL_U32): { + case FT(HAL_REAL, HAL_UINT): { rtapi_real v = hal_get_real(inst->inputs[s].r); - if (v > RTAPI_UINT32_MAX) { - hal_set_ui32(inst->output.u, RTAPI_UINT32_MAX); - } else if (v < 0) { - hal_set_ui32(inst->output.u, 0); + if (v > (rtapi_real)RTAPI_UINT_MAX) { + hal_set_uint(inst->output.u, RTAPI_UINT_MAX); + } else if (v < 0.0) { + hal_set_uint(inst->output.u, 0); } else { - hal_set_ui32(inst->output.u, v); + hal_set_uint(inst->output.u, v); } break; } + case FT(HAL_REAL, HAL_REAL): + hal_set_real(inst->output.r, hal_get_real(inst->inputs[s].r)); + break; - case FT(HAL_S32, HAL_BOOL): - hal_set_bool(inst->output.b, hal_get_si32(inst->inputs[s].s) != 0); + case FT(HAL_SINT, HAL_BOOL): + hal_set_bool(inst->output.b, hal_get_sint(inst->inputs[s].s) != 0); break; - case FT(HAL_S32, HAL_S32): - hal_set_si32(inst->output.s, hal_get_si32(inst->inputs[s].s)); + case FT(HAL_SINT, HAL_SINT): + hal_set_sint(inst->output.s, hal_get_sint(inst->inputs[s].s)); break; - case FT(HAL_S32, HAL_U32): { - rtapi_s32 v = hal_get_si32(inst->inputs[s].s); - hal_set_ui32(inst->output.u, v >= 0 ? v : 0); + case FT(HAL_SINT, HAL_UINT): { + rtapi_sint v = hal_get_sint(inst->inputs[s].s); + hal_set_uint(inst->output.u, v >= 0 ? v : 0); break; } - case FT(HAL_S32, HAL_REAL): - hal_set_real(inst->output.r, hal_get_si32(inst->inputs[s].s)); + case FT(HAL_SINT, HAL_REAL): + hal_set_real(inst->output.r, hal_get_sint(inst->inputs[s].s)); break; - case FT(HAL_U32, HAL_BOOL): - hal_set_bool(inst->output.b, hal_get_ui32(inst->inputs[s].u) != 0); + case FT(HAL_UINT, HAL_BOOL): + hal_set_bool(inst->output.b, hal_get_uint(inst->inputs[s].u) != 0); break; - case FT(HAL_U32, HAL_S32): { - rtapi_u32 v = hal_get_ui32(inst->inputs[s].u); - hal_set_si32(inst->output.s, v > RTAPI_INT32_MAX ? RTAPI_INT32_MAX : v); + case FT(HAL_UINT, HAL_SINT): { + rtapi_uint v = hal_get_uint(inst->inputs[s].u); + hal_set_sint(inst->output.s, v > RTAPI_SINT_MAX ? RTAPI_SINT_MAX : v); break; } - case FT(HAL_U32, HAL_U32): - hal_set_ui32(inst->output.u, hal_get_ui32(inst->inputs[s].u)); + case FT(HAL_UINT, HAL_UINT): + hal_set_uint(inst->output.u, hal_get_uint(inst->inputs[s].u)); break; - case FT(HAL_U32, HAL_REAL): - hal_set_real(inst->output.r, hal_get_ui32(inst->inputs[s].u)); + case FT(HAL_UINT, HAL_REAL): + hal_set_real(inst->output.r, hal_get_uint(inst->inputs[s].u)); break; } } diff --git a/src/hal/components/orient.comp b/src/hal/components/orient.comp index e0cc93f1478..07dba0092f8 100644 --- a/src/hal/components/orient.comp +++ b/src/hal/components/orient.comp @@ -1,7 +1,7 @@ component orient "Provide a PID command input for orientation mode based on current spindle position, target angle and orient mode"; pin in bool enable "enable angular output for orientation mode"; -pin in si32 mode "0: rotate - shortest move; 1: always rotate clockwise; 2: always rotate counterclockwise"; +pin in sint mode "0: rotate - shortest move; 1: always rotate clockwise; 2: always rotate counterclockwise"; pin in real position "spindle position input, unit 1 rev"; pin in real angle "orient target position in degrees, 0 ≤ angle < 360"; pin out real command "target spindle position, input to PID command"; diff --git a/src/hal/components/pid.c b/src/hal/components/pid.c index b35b11a8173..fb0b7c87f61 100644 --- a/src/hal/components/pid.c +++ b/src/hal/components/pid.c @@ -787,7 +787,7 @@ static int export_pid(hal_pid_t * addr, char * prefix) addr->state = STATE_PID; #endif /* AUTO_TUNER */ /* export function for this loop */ - retval = hal_export_functf(calc_pid, addr, 1, 0, comp_id, "%s.do-pid-calcs", prefix); + retval = hal_export_functf(calc_pid, addr, 0, comp_id, "%s.do-pid-calcs", prefix); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, NAME ": ERROR: do_pid_calcs funct export failed\n"); hal_exit(comp_id); diff --git a/src/hal/components/plasmac.comp b/src/hal/components/plasmac.comp index 92a9ba5b432..b7146429cd6 100644 --- a/src/hal/components/plasmac.comp +++ b/src/hal/components/plasmac.comp @@ -30,7 +30,7 @@ pin in real arc_lost_delay "arc lost delay during a cut (second pin in real arc_ok_high "maximum voltage level for Arc OK signal [mode 0] (volts)"; pin in bool arc_ok_in "external arc ok input signal [mode 1 & mode 2]"; pin in real arc_ok_low "minimum voltage level for Arc OK signal [mode 0] (volts)"; -pin in si32 arc_max_starts "maximum attempts at starting the arc"; +pin in sint arc_max_starts "maximum attempts at starting the arc"; pin in real arc_voltage_in "arc voltage input [mode 0 & mode 1] see Notes above"; pin in real arc_voltage_offset "offset to set arc voltage to 0 at 0 volts"; pin in real arc_voltage_scale "scale to convert arc_voltage input to actual volts"; @@ -69,7 +69,7 @@ pin in bool ignore_arc_ok_0 "Do not require arc ok for start or pin in bool ignore_arc_ok_1 "Do not require arc ok for start or cutting."; pin in real kerf_width "placeholder for better G-code portability between GUIs"; pin in bool laser_mode "laser mode for fiber lasers"; -pin in si32 laser_recovery_start "start laser offset for cut recovery"; +pin in sint laser_recovery_start "start laser offset for cut recovery"; pin in si32 laser_x_offset "alignment laser x axis offset (scaled units)"; pin in si32 laser_y_offset "alignment laser y axis offset (scaled units)"; pin in real lowpass_frequency "lowpass cutoff frequency for arc voltage output"; @@ -78,8 +78,8 @@ pin in real material_thickness "material thickness (machine units)" pin in si32 max_offset = 5 "maximum height offset (mm)"; pin in bool mesh_arc_ok = FALSE "Do not require arc ok for mesh mode."; pin in bool mesh_enable "enable mesh cutting mode"; -pin in si32 mode "operating mode"; -pin in si32 motion_type "motion type, connect to motion.motion-type"; +pin in sint mode "operating mode"; +pin in sint motion_type "motion type, connect to motion.motion-type"; pin in bool move_down "external thc down switch [mode 2]"; pin in bool move_up "external thc up switch [mode 2]"; pin in bool multi_tool = 1 "allows the use of multiple tools"; @@ -91,7 +91,7 @@ pin in bool offset_set_probe "deploy probe for setting offsets"; pin in bool offset_set_scribe "deploy scribe for setting offsets"; pin in bool offsets_active "offsets are active, connect to motion.eoffset-active"; pin in bool offsets_limited "offsets are limited, connect to motion.eoffset-limited"; -pin in si32 ohmic_max_attempts "maximum ohmic probe attempts before fallback to float switch"; +pin in sint ohmic_max_attempts "maximum ohmic probe attempts before fallback to float switch"; pin in bool ohmic_probe "ohmic probe input, from ohmic-sense-out or external component/pin"; pin in bool ohmic_probe_enable "enable ohmic probe"; pin in real ohmic_probe_offset "Z axis offset for ohmic probe (machine units)"; @@ -183,7 +183,7 @@ pin out real cut_time "cut time of current job"; pin out bool cutting_stop "stop manual cut, connect to halui.spindle.0.stop"; pin out bool feed_hold "feed hold, connect to motion.feed-hold"; pin out bool jog_inhibit "jog inhibit, connect to motion.jog-inhibit"; -pin out si32 laser_recovery_state "laser recovery status"; +pin out sint laser_recovery_state "laser recovery status"; pin out bool led_down "thc move down indicator"; pin out bool led_up "thc move up indicator"; pin out real offset_scale "offset scale, connect to axis..eoffset-scale"; @@ -191,7 +191,7 @@ pin out bool ohmic_enable "on only while probing"; pin out bool ohmic_sense_out "ohmic sense output state"; pin out bool paused_motion "paused motion flag, true when paused motion is active"; pin out real paused_time "paused time during current job"; -pin out si32 pierce_count "number of pierce attempts (torch starts)"; +pin out sint pierce_count "number of pierce attempts (torch starts)"; pin out bool probe_out "probe for tube cutting, connect to motion.probe-input"; pin out bool probe_test_error "minimum limit reached while probe testing"; pin out real probe_time "probe time of current job"; @@ -206,8 +206,8 @@ pin out bool safe_height_is_limited "safe height is limited indicator"; pin out bool sensor_active "one of float, ohmic, or breakaway is detected"; pin out bool scribe_arm "arm the scribe"; pin out bool scribe_on "turn scribe on"; -pin out si32 state_out "current state"; -pin out si32 stop_type_out "current stop type"; +pin out sint state_out "current state"; +pin out sint stop_type_out "current stop type"; pin out bool thc_active "thc status output"; pin out bool thc_enabled "thc is enabled"; pin out bool torch_on "turn torch on, connect to your torch on input"; @@ -1503,13 +1503,13 @@ FUNCTION(_) { cutting_stop_set(1); state = MAX_HEIGHT; if (!error_message){ - rtapi_print_msg(RTAPI_MSG_ERR,"no arc detected after %d start attempts\nmanual cut is stopped.\n", arc_max_starts); + rtapi_print_msg(RTAPI_MSG_ERR,"no arc detected after %ld start attempts\nmanual cut is stopped.\n", arc_max_starts); error_message = 1; } }else{ program_pause_set(TRUE); if (!error_message){ - rtapi_print_msg(RTAPI_MSG_ERR,"no arc detected after %d start attempts\nprogram is paused.\n", arc_max_starts); + rtapi_print_msg(RTAPI_MSG_ERR,"no arc detected after %ld start attempts\nprogram is paused.\n", arc_max_starts); error_message = 1; } } diff --git a/src/hal/components/pushmsg.comp b/src/hal/components/pushmsg.comp index adbe0e8e306..ef1f3f5288d 100644 --- a/src/hal/components/pushmsg.comp +++ b/src/hal/components/pushmsg.comp @@ -30,12 +30,10 @@ following syntax: + Each placeholder creates a typed input pin *pushmsg*.____.____ that the user wires up to the source signal. The type letter in the placeholder selects the pin type: - * `b` - bit - * `s` - s32 - * `u` - u32 - * `l` - s64 - * `k` - u64 - * `f` - float + * `b` - bool + * `s`,`l` - sint + * `u`,`k` - uint + * `f`,`r` - real Each message line is limited to 128 characters in length. The length count includes the `level` indicator, `pinname`, `message` text and the `|` separator @@ -284,32 +282,25 @@ static int setup_message(const char *pfx, int idx, const char *msg, msg_slot_t * return rv; break; case 's': case 'S': - slot->substtype[subst] = HAL_S32; - if ((rv = hal_pin_new_si32(comp_id, HAL_IN, &pin->substs[subst].s, 0, "%s.%s", pinname, cptr)) < 0) - return rv; - break; - case 'u': case 'U': - slot->substtype[subst] = HAL_U32; - if ((rv = hal_pin_new_ui32(comp_id, HAL_IN, &pin->substs[subst].u, 0, "%s.%s", pinname, cptr)) < 0) - return rv; - break; case 'l': case 'L': slot->substtype[subst] = HAL_SINT; if ((rv = hal_pin_new_sint(comp_id, HAL_IN, &pin->substs[subst].s, 0, "%s.%s", pinname, cptr)) < 0) return rv; break; + case 'u': case 'U': case 'k': case 'K': slot->substtype[subst] = HAL_UINT; if ((rv = hal_pin_new_uint(comp_id, HAL_IN, &pin->substs[subst].u, 0, "%s.%s", pinname, cptr)) < 0) return rv; break; case 'f': case 'F': + case 'r': case 'R': slot->substtype[subst] = HAL_REAL; if ((rv = hal_pin_new_real(comp_id, HAL_IN, &pin->substs[subst].r, 0.0, "%s.%s", pinname, cptr)) < 0) return rv; break; default: - rtapi_print_msg(RTAPI_MSG_ERR, "%s: Message %d bad substitution type '%c', expected one of {b,f,s,u,k,l}\n", + rtapi_print_msg(RTAPI_MSG_ERR, "%s: Message %d bad substitution type '%c', expected one of {b,f,r,s,u,k,l}\n", pfx, idx, printable(tchar)); return -EBADMSG; } @@ -390,12 +381,6 @@ static void print_slot(int s) case HAL_BOOL: n = rtapi_snprintf(end, left, "%d%s", (int)hal_get_bool(pins[s].substs[i].b), slots[s].parts[i]); break; - case HAL_S32: - n = rtapi_snprintf(end, left, "%d%s", (int)hal_get_si32(pins[s].substs[i].s), slots[s].parts[i]); - break; - case HAL_U32: - n = rtapi_snprintf(end, left, "%u%s", (unsigned)hal_get_ui32(pins[s].substs[i].u), slots[s].parts[i]); - break; case HAL_SINT: n = rtapi_snprintf(end, left, "%ld%s", (long)hal_get_sint(pins[s].substs[i].s), slots[s].parts[i]); break; diff --git a/src/hal/components/pwmgen.c b/src/hal/components/pwmgen.c index 4575748f56d..76582636bb0 100644 --- a/src/hal/components/pwmgen.c +++ b/src/hal/components/pwmgen.c @@ -192,7 +192,7 @@ int rtapi_app_main(void) } /* export functions */ retval = hal_export_funct("pwmgen.make-pulses", make_pulses, - pwmgen_array, 0, 0, comp_id); + pwmgen_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PWMGEN: ERROR: makepulses funct export failed\n"); @@ -200,7 +200,7 @@ int rtapi_app_main(void) return -1; } retval = hal_export_funct("pwmgen.update", update, - pwmgen_array, 1, 0, comp_id); + pwmgen_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PWMGEN: ERROR: update funct export failed\n"); diff --git a/src/hal/components/radiobutton.comp b/src/hal/components/radiobutton.comp index c3938516abb..52bc2aaaa20 100644 --- a/src/hal/components/radiobutton.comp +++ b/src/hal/components/radiobutton.comp @@ -1,17 +1,17 @@ component radiobutton "Select one from several outputs with momentary switches"; -description """This component creates \\fBpersonality\\fR inputs to select -one of several outputs. When \\fBsel-N\\fR is momentarily set high then the -corresponding bit output \\fBout-N\\fR will be set high and other outputs will -be set low. Simultaneously the value on the pin \\fBinput-N\\fR will be copied -to the \\fBvalue\\fR pin. -The \\fBselected\\fR pin will indicate which set of outputs is currently +description """This component creates *personality* inputs to select +one of several outputs. When *sel-N* is momentarily set high then the +corresponding bit output *out-N* will be set high and other outputs will +be set low. Simultaneously the value on the pin *input-N* will be copied +to the *value* pin. +The *selected* pin will indicate which set of outputs is currently active. Note that channel-0 should be used to provide the default values."""; pin in bool sel-##[32:personality] "Inputs to select a channel"; pin out bool out-##[32:personality] "output selected"; -pin out si32 selected = 0 "indicates which output is currently active"; +pin out sint selected = 0 "indicates which output is currently active"; pin in real input-##[32:personality] "Possible output values"; pin out real value "currently-selected output value"; @@ -23,7 +23,7 @@ author "Andy Pugh"; ;; FUNCTION(_){ - rtapi_s32 s = selected; + rtapi_sint s = selected; for(int i = 0; i < personality; i++){ if(sel(i) !=0){ s = selected_set(i); diff --git a/src/hal/components/raster.comp b/src/hal/components/raster.comp index 553c6df9515..2dafd576913 100644 --- a/src/hal/components/raster.comp +++ b/src/hal/components/raster.comp @@ -7,17 +7,17 @@ pin in bool run "starts the raster"; pin out bool enabled = 0 "When a valid raster program is running."; pin out real output = -1 "current output level command"; pin out bool fault = 0 "If error has occurred"; -pin out si32 fault_code = 0 "Code of fault"; -pin out si32 state = 0 "current state"; +pin out sint fault_code = 0 "Code of fault"; +pin out sint state = 0 "current state"; pin out real program_position = 0.0 "base position of program at run start"; pin out real program_offset = 0.0 "offset to start of pixel data"; -pin out si32 bpp = 0 "bits per pixel."; +pin out sint bpp = 0 "bits per pixel."; pin out real ppu = 0.0 "pixels per unit"; -pin out si32 count = 0 "pixel count"; +pin out sint count = 0 "pixel count"; pin out real bitmap_position = 0.0 "calculated position in bitmap"; pin out real current_pixel_value = -1.0 "current loaded pixel value"; pin out real previous_pixel_value = -1.0 "previously loaded pixel value"; -pin out si32 current_pixel_index = -1 "currently loaded pixel index"; +pin out sint current_pixel_index = -1 "currently loaded pixel index"; pin out real fraction = 0.0; description """ @@ -95,7 +95,7 @@ static bool float_eq(rtapi_real a, rtapi_real b) { return fabs(a-b) < epsilon; } -static bool read_float(const hal_port_t *port, hal_real_t value) { +static bool read_float(const hal_port_t port, hal_real_t value) { char data[32]; int available = hal_port_readable(port); char* pos; @@ -119,7 +119,7 @@ static bool read_float(const hal_port_t *port, hal_real_t value) { return true; } -static bool read_int(const hal_port_t *port, hal_sint_t value) { +static bool read_int(const hal_port_t port, hal_sint_t value) { char data[10]; long val; int available = hal_port_readable(port); @@ -143,7 +143,7 @@ static bool read_int(const hal_port_t *port, hal_sint_t value) { return false; } - hal_set_si32(value, val); + hal_set_sint(value, val); hal_port_peek_commit(port, pos - data + 1); @@ -157,7 +157,7 @@ static bool read_int(const hal_port_t *port, hal_sint_t value) { pixels bpp must be defined in increments of 4. a pixel value with all 1 bits is a special value considered "off" for the raster and no power will be output */ -static bool read_pixel_data(const hal_port_t *port, int bits_per_pixel, hal_real_t power) { +static bool read_pixel_data(const hal_port_t port, int bits_per_pixel, hal_real_t power) { char data[8]; long value = 0; unsigned int off = 0xFFFFFFFF >> (32 - bits_per_pixel); @@ -241,7 +241,7 @@ FUNCTION(_) { enabled_set(1); //consume pixel data as needed from programming port - while((current_pixel_index < (((int)count)-1)) && ((rtapi_real)current_pixel_index < bitmap_position)) { + while((current_pixel_index < (((rtapi_sint)count)-1)) && ((rtapi_real)current_pixel_index < bitmap_position)) { current_pixel_index_set(current_pixel_index+1); previous_pixel_value_set(current_pixel_value); diff --git a/src/hal/components/reset.comp b/src/hal/components/reset.comp index fb198026d80..b29c5e0d77d 100644 --- a/src/hal/components/reset.comp +++ b/src/hal/components/reset.comp @@ -37,15 +37,15 @@ ******************************************************************************/ component reset "Resets an IO signal"; -pin in bool trigger "Trigger input"; -pin io ui32 out_u32 = 0 "Unsigned 32 bit integer output value"; -pin in ui32 reset_u32 = 0 "Unsigned 32 bit integer reset value"; -pin io si32 out_s32 = 0 "Signed 32 bit integer output value"; -pin in si32 reset_s32 = 0 "Signed 32 bit integer reset value"; -pin io real out_float = 0.0 "Float output value"; -pin in real reset_float = 0.0 "Float reset value"; -pin io bool out_bit = false "Bit integer output value"; -pin in bool reset_bit = false "Bit reset value"; +pin in bool trigger "Trigger input"; +pin io uint out_uint = 0 "Unsigned integer output value"; +pin in uint reset_uint = 0 "Unsigned integer reset value"; +pin io sint out_sint = 0 "Signed integer output value"; +pin in sint reset_sint = 0 "Signed integer reset value"; +pin io real out_real = 0.0 "Float output value"; +pin in real reset_real = 0.0 "Float reset value"; +pin io bool out_bool = false "Bit integer output value"; +pin in bool reset_bool = false "Bit reset value"; pin in bool retriggerable = true "Allow additional edges to reset"; pin in bool rising = true "Trigger on rising edge"; pin in bool falling = false "Trigger on falling edge"; @@ -67,10 +67,10 @@ FUNCTION(_) { rtapi_bool new_trigger = trigger; if ((new_trigger != last_trigger) && ((rising && (new_trigger)) || (falling && (!new_trigger)))) { - out_u32_set(reset_u32); - out_s32_set(reset_s32); - out_float_set(reset_float); - out_bit_set(reset_bit); + out_uint_set(reset_uint); + out_sint_set(reset_sint); + out_real_set(reset_real); + out_bool_set(reset_bool); } last_trigger = new_trigger; } diff --git a/src/hal/components/safety_latch.comp b/src/hal/components/safety_latch.comp index 6c30637b27e..6785247e54c 100644 --- a/src/hal/components/safety_latch.comp +++ b/src/hal/components/safety_latch.comp @@ -53,15 +53,15 @@ The inputs pin min and max clamp the error count value to a specified range. """; pin in bool error_in = false "Error Input"; -pin in si32 heal = 1 "Heal when ok per tick"; -pin in si32 harm = 1 "Harm when error per tick"; +pin in sint heal = 1 "Heal when ok per tick"; +pin in sint harm = 1 "Harm when error per tick"; pin in bool latching = true "If a reset is necessary to heal an error"; pin in bool reset = false "Reset input"; -pin in si32 threshold = 100 "Error output threshold"; -pin in si32 min_ = 0 "Minimum count"; -pin in si32 max_ = 1000 "Maximum count"; +pin in sint threshold = 100 "Error output threshold"; +pin in sint min_ = 0 "Minimum count"; +pin in sint max_ = 1000 "Maximum count"; pin in bool enable = true "If not enabled the error count is passed to the output"; -pin out si32 count = 0 "Current count"; +pin out sint count = 0 "Current count"; pin out bool error_out = false "Error output"; pin out bool ok_out = true "Ok output"; diff --git a/src/hal/components/sample_hold.comp b/src/hal/components/sample_hold.comp index bf64254c20b..4f9c2525eed 100644 --- a/src/hal/components/sample_hold.comp +++ b/src/hal/components/sample_hold.comp @@ -1,7 +1,7 @@ component sample_hold "Sample and Hold"; -pin in si32 in; +pin in sint in; pin in bool hold; -pin out si32 out; +pin out sint out; option period no; function _; see_also "*tristate*(9)"; diff --git a/src/hal/components/sampler.c b/src/hal/components/sampler.c index 996091c7de7..9d273a4993f 100644 --- a/src/hal/components/sampler.c +++ b/src/hal/components/sampler.c @@ -168,8 +168,6 @@ static void sample(void *arg, long period) for (int n = 0; n < num_pins; n++) { switch (hal_stream_element_type(&samp->fifo, n)) { case HAL_REAL: data[n].f = hal_get_real(samp->pins[n].r); break; - case HAL_S32: data[n].s = hal_get_si32(samp->pins[n].s); break; - case HAL_U32: data[n].u = hal_get_ui32(samp->pins[n].u); break; case HAL_SINT: data[n].l = hal_get_sint(samp->pins[n].s); break; case HAL_UINT: data[n].k = hal_get_uint(samp->pins[n].u); break; case HAL_BOOL: data[n].b = hal_get_bool(samp->pins[n].b); break; @@ -231,8 +229,6 @@ static int init_sampler(int num, sampler_t *str) int type; switch(type = hal_stream_element_type(&str->fifo, n)) { case HAL_REAL: retval = hal_pin_new_real(comp_id, HAL_IN, &str->pins[n].r, 0.0, pstr, num, n); break; - case HAL_S32: retval = hal_pin_new_si32(comp_id, HAL_IN, &str->pins[n].s, 0, pstr, num, n); break; - case HAL_U32: retval = hal_pin_new_ui32(comp_id, HAL_IN, &str->pins[n].u, 0, pstr, num, n); break; case HAL_SINT: retval = hal_pin_new_sint(comp_id, HAL_IN, &str->pins[n].s, 0, pstr, num, n); break; case HAL_UINT: retval = hal_pin_new_uint(comp_id, HAL_IN, &str->pins[n].u, 0, pstr, num, n); break; case HAL_BOOL: retval = hal_pin_new_bool(comp_id, HAL_IN, &str->pins[n].b, 0, pstr, num, n); break; @@ -246,7 +242,7 @@ static int init_sampler(int num, sampler_t *str) } } /* export update function */ - retval = hal_export_functf(sample, str, 1, 0, comp_id, "%s%d", strbase, num); + retval = hal_export_functf(sample, str, 0, comp_id, "%s%d", strbase, num); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "SAMPLER: ERROR: function export failed\n"); return retval; diff --git a/src/hal/components/sampler_usr.c b/src/hal/components/sampler_usr.c index ab4cd207640..71d2abeaa9e 100644 --- a/src/hal/components/sampler_usr.c +++ b/src/hal/components/sampler_usr.c @@ -220,12 +220,6 @@ int main(int argc, char **argv) printf ( "0 " ); } break; - case HAL_U32: - printf ( "%lu ", (unsigned long)buf[n].u); - break; - case HAL_S32: - printf ( "%ld ", (long)buf[n].s); - break; case HAL_UINT: printf ( "%llu ", (unsigned long long)buf[n].k); break; diff --git a/src/hal/components/scaled_s32_sums.comp b/src/hal/components/scaled_sint_sums.comp similarity index 72% rename from src/hal/components/scaled_s32_sums.comp rename to src/hal/components/scaled_sint_sums.comp index 86e4f611c75..f60f7250580 100644 --- a/src/hal/components/scaled_s32_sums.comp +++ b/src/hal/components/scaled_sint_sums.comp @@ -1,14 +1,14 @@ -component scaled_s32_sums "Sum of four inputs (each with a scale)"; +component scaled_sint_sums "Sum of four inputs (each with a scale)"; see_also "sum2(9), weighted_sum(9)"; -pin in si32 in0; -pin in si32 in1; -pin in si32 in2; -pin in si32 in3; +pin in sint in0; +pin in sint in1; +pin in sint in2; +pin in sint in3; pin in real scale0 = 1.0; pin in real scale1 = 1.0; pin in real scale2 = 1.0; pin in real scale3 = 1.0; -pin out si32 out_s; +pin out sint out_s; pin out real out_f "out-s = out-f = (in0 * scale0) + (in1 * scale1) + (in2 * scale2) + (in3 * scale3)"; option period no; function _; diff --git a/src/hal/components/select8.comp b/src/hal/components/select8.comp index da4c0e5bc70..135d7bce44c 100644 --- a/src/hal/components/select8.comp +++ b/src/hal/components/select8.comp @@ -1,6 +1,6 @@ component select8 "8-bit binary match detector"; pin in bool enable = TRUE "Set enable to FALSE to cause all outputs to be set FALSE."; -pin in si32 sel "The number of the output to set TRUE. All other outputs well be set FALSE."; +pin in sint sel "The number of the output to set TRUE. All other outputs well be set FALSE."; pin out bool out#[8] "Output bits. If enable is set and the sel input is between 0 and 7, then the corresponding output bit will be set true."; option period no; function _; @@ -9,7 +9,7 @@ license "GPL"; author "Stephen Wille Padnos"; ;; FUNCTION(_) { - rtapi_s32 temp_sel = sel; + rtapi_sint temp_sel = sel; rtapi_bool temp_enable = enable; for (int i=0;i<8;i++) { if (!temp_enable || temp_sel!=i) diff --git a/src/hal/components/siggen.c b/src/hal/components/siggen.c index b1c84d6560c..c92c2b8fc4b 100644 --- a/src/hal/components/siggen.c +++ b/src/hal/components/siggen.c @@ -335,7 +335,7 @@ static int export_siggen(int num, hal_siggen_t * addr,char* prefix) addr->index = 0.0; /* export function for this loop */ retval = - hal_export_functf(calc_siggen, &(siggen_array[num]), 1, 0, + hal_export_functf(calc_siggen, &(siggen_array[num]), 0, comp_id, "%s.update", prefix); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, diff --git a/src/hal/components/sim_encoder.c b/src/hal/components/sim_encoder.c index 0351b835ece..1e02030b178 100644 --- a/src/hal/components/sim_encoder.c +++ b/src/hal/components/sim_encoder.c @@ -197,7 +197,7 @@ int rtapi_app_main(void) } /* export functions */ retval = hal_export_funct("sim-encoder.make-pulses", make_pulses, - sim_enc_array, 0, 0, comp_id); + sim_enc_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "SIM_ENCODER: ERROR: makepulses funct export failed\n"); @@ -205,7 +205,7 @@ int rtapi_app_main(void) return -1; } retval = hal_export_funct("sim-encoder.update-speed", update_speed, - sim_enc_array, 1, 0, comp_id); + sim_enc_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "SIM_ENCODER: ERROR: speed update funct export failed\n"); diff --git a/src/hal/components/sim_matrix_kb.comp b/src/hal/components/sim_matrix_kb.comp index aabe7915b4f..ed4b79e3b0f 100644 --- a/src/hal/components/sim_matrix_kb.comp +++ b/src/hal/components/sim_matrix_kb.comp @@ -1,6 +1,6 @@ component sim_matrix_kb "convert HAL pin inputs to keycodes"; -pin out ui32 out "pin that outputs the Keycode"; +pin out uint out "pin that outputs the Keycode"; pin in bool button.c00.r##[8] "array of inputs"; pin in bool button.c01.r##[8] "array of inputs"; diff --git a/src/hal/components/sphereprobe.comp b/src/hal/components/sphereprobe.comp index 1b20485857b..d10d5422536 100644 --- a/src/hal/components/sphereprobe.comp +++ b/src/hal/components/sphereprobe.comp @@ -2,27 +2,28 @@ component sphereprobe "Probe a pretend hemisphere"; author "Jeff Epler"; license "GPL"; -pin in si32 px; -pin in si32 py; -pin in si32 pz "*rawcounts* position from software encoder"; +pin in sint px; +pin in sint py; +pin in sint pz "*rawcounts* position from software encoder"; -pin in si32 cx; -pin in si32 cy; -pin in si32 cz "Center of sphere in counts"; -pin in si32 r "Radius of hemisphere in counts"; +pin in sint cx; +pin in sint cy; +pin in sint cz "Center of sphere in counts"; +pin in sint r "Radius of hemisphere in counts"; pin out bool probe-out; option period no; function _ "update probe-out based on inputs"; ;; -#undef abs -int abs(int x) { if(x < 0) return -x; else return x; } +static inline rtapi_uint myabs(rtapi_sint x) { return x < 0 ? -x : x; } FUNCTION(_) { - rtapi_u64 dx = abs(px-cx), dy=abs(py-cy), dz=abs(pz-cz); - rtapi_u64 d2 = dx*dx + dy*dy; - rtapi_u64 r2 = (rtapi_s64)r*(rtapi_s64)r; + rtapi_uint dx = myabs(px-cx); + rtapi_uint dy = myabs(py-cy); + rtapi_uint dz = myabs(pz-cz); + rtapi_uint d2 = dx*dx + dy*dy; + rtapi_uint r2 = r*r; if(d2 > r2) { probe_out_set(pz < cz); } else { diff --git a/src/hal/components/spindle.comp b/src/hal/components/spindle.comp index 11cc86faa9e..c01b733278d 100644 --- a/src/hal/components/spindle.comp +++ b/src/hal/components/spindle.comp @@ -50,7 +50,7 @@ Each gear has individual control of speeds, acceleration, driver gain and direct see_also "*motion*(9)"; -pin in ui32 select-gear +pin in uint select-gear """Select a gear. Must be in the range 0 -> number of available gears -1. If you use this, do not use the select.x input pins."""; pin in real commanded-speed "Commanded spindle speed (in RPM)"; @@ -66,7 +66,7 @@ Uses the encoder input if available. If not, uses a simulated encoder speed."""; pin out real spindle-rpm-abs "Absolute spindle speed in RPM. Useful for spindle speed displays."; pin out real output "Scaled output"; -pin out ui32 current-gear "Currently selected gear."; +pin out uint current-gear "Currently selected gear."; pin out bool at-speed "TRUE when the spindle is at speed"; pin out bool forward "TRUE for forward rotation"; diff --git a/src/hal/components/spindle_monitor.comp b/src/hal/components/spindle_monitor.comp index bfa65e98acb..28423cce9d1 100644 --- a/src/hal/components/spindle_monitor.comp +++ b/src/hal/components/spindle_monitor.comp @@ -6,7 +6,7 @@ pin in real spindle-feedback; pin out bool spindle-at-speed; pin out bool spindle-underspeed; -param rw ui32 level "state machine state"; +param rw uint level "state machine state"; param rw real threshold; option period no; diff --git a/src/hal/components/stepgen.c b/src/hal/components/stepgen.c index f10612c2581..12f0882b031 100644 --- a/src/hal/components/stepgen.c +++ b/src/hal/components/stepgen.c @@ -512,7 +512,7 @@ int rtapi_app_main(void) } /* export functions */ retval = hal_export_funct("stepgen.make-pulses", make_pulses, - stepgen_array, 0, 0, comp_id); + stepgen_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "STEPGEN: ERROR: makepulses funct export failed\n"); @@ -520,7 +520,7 @@ int rtapi_app_main(void) return -1; } retval = hal_export_funct("stepgen.update-freq", update_freq, - stepgen_array, 1, 0, comp_id); + stepgen_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "STEPGEN: ERROR: freq update funct export failed\n"); @@ -528,7 +528,7 @@ int rtapi_app_main(void) return -1; } retval = hal_export_funct("stepgen.capture-position", update_pos, - stepgen_array, 1, 0, comp_id); + stepgen_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "STEPGEN: ERROR: pos update funct export failed\n"); diff --git a/src/hal/components/steptest.comp b/src/hal/components/steptest.comp index 422b4e1a45c..be7d12f3d2f 100644 --- a/src/hal/components/steptest.comp +++ b/src/hal/components/steptest.comp @@ -6,7 +6,7 @@ pin in bool run "Drive TRUE to run the axis near its current position_fb with a pin in real maxvel "Maximum velocity"; pin in real maxaccel "Permitted Acceleration"; pin in real amplitude "Approximate amplitude of positions to command during 'run'"; -pin in si32 dir "Direction from central point to test: 0 = both, 1 = positive, 2 = negative"; +pin in sint dir "Direction from central point to test: 0 = both, 1 = positive, 2 = negative"; pin out real position-cmd; pin in real position-fb; pin out bool running; @@ -14,11 +14,11 @@ pin out real run-target; pin out real run-start; pin out real run-low; pin out real run-high; -pin in si32 pause = 0 "pause time for each end of run in seconds"; +pin in sint pause = 0 "pause time for each end of run in seconds"; param rw real epsilon = .001; variable rtapi_real timer; param r real elapsed "Current value of the internal timer"; -variable int timer_on; +variable rtapi_sint timer_on; function _; license "GPL"; author "Jeff Epler"; diff --git a/src/hal/components/streamer.c b/src/hal/components/streamer.c index 7c1d7714f52..12b2d363abf 100644 --- a/src/hal/components/streamer.c +++ b/src/hal/components/streamer.c @@ -224,8 +224,6 @@ static void update(void *arg, long period) for (int n = 0; n < num_pins; n++) { switch ( hal_stream_element_type(&str->fifo, n) ) { case HAL_REAL: hal_set_real(str->pins[n].r, data[n].f); break; - case HAL_S32: hal_set_si32(str->pins[n].s, data[n].s); break; - case HAL_U32: hal_set_ui32(str->pins[n].u, data[n].u); break; case HAL_SINT: hal_set_sint(str->pins[n].s, data[n].l); break; case HAL_UINT: hal_set_uint(str->pins[n].u, data[n].k); break; case HAL_BOOL: hal_set_bool(str->pins[n].b, data[n].b); break; @@ -277,8 +275,6 @@ static int init_streamer(int num, streamer_t *str) int type; switch(type = hal_stream_element_type(&str->fifo, n)) { case HAL_REAL: retval = hal_pin_new_real(comp_id, HAL_OUT, &str->pins[n].r, 0.0, pstr, num, n); break; - case HAL_S32: retval = hal_pin_new_si32(comp_id, HAL_OUT, &str->pins[n].s, 0, pstr, num, n); break; - case HAL_U32: retval = hal_pin_new_ui32(comp_id, HAL_OUT, &str->pins[n].u, 0, pstr, num, n); break; case HAL_SINT: retval = hal_pin_new_sint(comp_id, HAL_OUT, &str->pins[n].s, 0, pstr, num, n); break; case HAL_UINT: retval = hal_pin_new_uint(comp_id, HAL_OUT, &str->pins[n].u, 0, pstr, num, n); break; case HAL_BOOL: retval = hal_pin_new_bool(comp_id, HAL_OUT, &str->pins[n].b, 0, pstr, num, n); break; @@ -292,7 +288,7 @@ static int init_streamer(int num, streamer_t *str) } } /* export update function */ - retval = hal_export_functf(update, str, 1, 0, comp_id, "%s%d", strbase, num); + retval = hal_export_functf(update, str, 0, comp_id, "%s%d", strbase, num); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "STREAMER: ERROR: function export failed\n"); return retval; diff --git a/src/hal/components/streamer_usr.c b/src/hal/components/streamer_usr.c index bbbf632b1b6..2ba5d9168f1 100644 --- a/src/hal/components/streamer_usr.c +++ b/src/hal/components/streamer_usr.c @@ -201,12 +201,6 @@ int main(int argc, char **argv) cp2 = cp; } break; - case HAL_U32: - dptr->u = strtoul(cp, &cp2, 10); - break; - case HAL_S32: - dptr->s = strtol(cp, &cp2, 10); - break; case HAL_UINT: dptr->k = strtoull(cp, &cp2, 10); break; diff --git a/src/hal/components/sum2.comp b/src/hal/components/sum2.comp index 387ac548572..25fbf4588f3 100644 --- a/src/hal/components/sum2.comp +++ b/src/hal/components/sum2.comp @@ -1,5 +1,5 @@ component sum2 "Sum of two inputs (each with a gain) and an offset"; -see_also "scaled_s32_sums(9), weighted_sum(9)"; +see_also "scaled_sint_sums(9), weighted_sum(9)"; pin in real in0; pin in real in1; param rw real gain0 = 1.0; diff --git a/src/hal/components/supply.c b/src/hal/components/supply.c index 8591cbe865f..5412225f67e 100644 --- a/src/hal/components/supply.c +++ b/src/hal/components/supply.c @@ -190,7 +190,7 @@ static int export_supply(int num, hal_supply_t * addr) } /* export function for this loop */ retval = - hal_export_functf(update_supply, &(supply_array[num]), 1, 0, + hal_export_functf(update_supply, &(supply_array[num]), 0, comp_id, "supply.%d.update", num); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, diff --git a/src/hal/components/threads.c b/src/hal/components/threads.c index f5b58a83569..1ca51f190f9 100644 --- a/src/hal/components/threads.c +++ b/src/hal/components/threads.c @@ -107,7 +107,7 @@ int rtapi_app_main(void) /* was 'period' specified in the insmod command? */ if ((period1 > 0) && (name1 != NULL) && (*name1 != '\0')) { /* create a thread */ - thread1_id = hal_create_thread(name1, period1, 1); + thread1_id = hal_create_thread(name1, period1); if (thread1_id < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "THREADS: ERROR: could not create thread '%s'\n", name1); @@ -119,7 +119,7 @@ int rtapi_app_main(void) } if ((period2 > 0) && (name2 != NULL) && (*name2 != '\0')) { /* create a thread */ - thread2_id = hal_create_thread(name2, period2, 1); + thread2_id = hal_create_thread(name2, period2); if (thread2_id < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "THREADS: ERROR: could not create thread '%s'\n", name2); @@ -132,7 +132,7 @@ int rtapi_app_main(void) } if ((period3 > 0) && (name3 != NULL) && (*name3 != '\0')) { /* create a thread */ - thread3_id = hal_create_thread(name3, period3, 1); + thread3_id = hal_create_thread(name3, period3); if (thread3_id < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "THREADS: ERROR: could not create thread '%s'\n", name3); diff --git a/src/hal/components/threadtest.comp b/src/hal/components/threadtest.comp index 50c20772ca6..79b523f18c7 100644 --- a/src/hal/components/threadtest.comp +++ b/src/hal/components/threadtest.comp @@ -1,5 +1,5 @@ component threadtest "LinuxCNC HAL component for testing thread behavior"; -pin out ui32 count; +pin out uint count; option period no; function increment; function reset; diff --git a/src/hal/components/time.comp b/src/hal/components/time.comp index 2aa4061c5c3..1fa8ce4c5e1 100644 --- a/src/hal/components/time.comp +++ b/src/hal/components/time.comp @@ -104,13 +104,13 @@ pin in bool start "Timer On"; pin in bool pause = 0 "Pause"; // Output Pins -pin out ui32 seconds "Seconds"; -pin out ui32 minutes "Minutes"; -pin out ui32 hours "Hours"; +pin out uint seconds "Seconds"; +pin out uint minutes "Minutes"; +pin out uint hours "Hours"; // Global Variables variable rtapi_real totalnsec; -variable int old_start; +variable rtapi_bool old_start; function _; @@ -118,8 +118,8 @@ function _; FUNCTION(_) { - rtapi_u32 totalseconds; - int running = start || pause; + rtapi_uint totalseconds; + rtapi_bool running = start || pause; if(running && !old_start) totalnsec = 0; if(start && !pause){ diff --git a/src/hal/components/timedelta.comp b/src/hal/components/timedelta.comp index c43fcc58b18..027f3d7abdb 100644 --- a/src/hal/components/timedelta.comp +++ b/src/hal/components/timedelta.comp @@ -1,20 +1,20 @@ component timedelta "LinuxCNC HAL component that measures thread scheduling timing behavior"; -pin out si32 jitter=0 "Worst-case scheduling error (in ns). This is the largest discrepancy between ideal thread period, and actual time between sequential runs of this component. This uses the absolute value of the error, so 'got run too early' and 'got run too late' both show up as positive jitter."; +pin out sint jitter=0 "Worst-case scheduling error (in ns). This is the largest discrepancy between ideal thread period, and actual time between sequential runs of this component. This uses the absolute value of the error, so 'got run too early' and 'got run too late' both show up as positive jitter."; -pin out si32 current_jitter=0 "Scheduling error (in ns) of the current invocation. This is the discrepancy between ideal thread period, and actual time since the previous run of this component. This uses the absolute value of the error, so 'got run too early' and 'got run too late' both show up as positive jitter."; +pin out sint current_jitter=0 "Scheduling error (in ns) of the current invocation. This is the discrepancy between ideal thread period, and actual time since the previous run of this component. This uses the absolute value of the error, so 'got run too early' and 'got run too late' both show up as positive jitter."; -pin out si32 current_error=0 "Scheduling error (in ns) of the current invocation. This is the discrepancy between ideal thread period, and actual time since the previous run of this component. This does not use the absolute value of the error, so 'got run too early' shows up as negative error and 'got run too late' shows up as positive error."; +pin out sint current_error=0 "Scheduling error (in ns) of the current invocation. This is the discrepancy between ideal thread period, and actual time since the previous run of this component. This does not use the absolute value of the error, so 'got run too early' shows up as negative error and 'got run too late' shows up as positive error."; -pin out si32 min_=0 "Minimum time (in ns) between sequential runs of this component."; +pin out sint min_=0 "Minimum time (in ns) between sequential runs of this component."; -pin out si32 max_=0 "Maximum time (in ns) between sequential runs of this component."; +pin out sint max_=0 "Maximum time (in ns) between sequential runs of this component."; pin in bool reset "Set this pin to True, then back to False, to reset some of the statistics."; -pin out si32 out "Time (in ns) since the previous run of this component. This should ideally be equal to the thread period."; +pin out sint out "Time (in ns) since the previous run of this component. This should ideally be equal to the thread period."; -pin out si32 err=0 "Cumulative time error (in ns). Probably not useful."; +pin out sint err=0 "Cumulative time error (in ns). Probably not useful."; pin out real avg_err=0 "The average scheduling error (in ns)."; diff --git a/src/hal/components/toggle.comp b/src/hal/components/toggle.comp index f8dbb86628c..083556dfe8a 100644 --- a/src/hal/components/toggle.comp +++ b/src/hal/components/toggle.comp @@ -14,7 +14,7 @@ out: └─────┘           └───── pin in bool in "button input"; pin io bool out "on/off output"; -param rw ui32 debounce = 2 "debounce delay in periods"; +param rw uint debounce = 2 "debounce delay in periods"; option data toggle_data; option period no; @@ -29,7 +29,7 @@ typedef struct { } toggle_data; FUNCTION(_) { - rtapi_u32 deb = debounce; + rtapi_uint deb = debounce; if (( deb < 1 ) || ( deb > 10000 )) { /* set a sane value, we don't want 2 million second delays */ debounce_set(deb = 2); diff --git a/src/hal/components/toggle2nist.comp b/src/hal/components/toggle2nist.comp index 9c164425f21..a8605314899 100644 --- a/src/hal/components/toggle2nist.comp +++ b/src/hal/components/toggle2nist.comp @@ -30,12 +30,12 @@ is-on: └─────────────────┘        pin in bool in "toggle button in"; pin in bool is_on "current state of device"; -pin in ui32 debounce = 2 "debounce delay for 'in'-pin in cycles"; -pin in ui32 max_pulse_length = 100 "max output pulse length"; +pin in uint debounce = 2 "debounce delay for 'in'-pin in cycles"; +pin in uint max_pulse_length = 100 "max output pulse length"; pin out bool on "turn device on"; pin out bool off "turn device off"; -variable unsigned debounce_cntr; -variable unsigned pulse_length; +variable rtapi_uint debounce_cntr; +variable rtapi_uint pulse_length; variable bool state; option period no; diff --git a/src/hal/components/updown.comp b/src/hal/components/updown.comp index 51bea6764be..9d6a1633648 100644 --- a/src/hal/components/updown.comp +++ b/src/hal/components/updown.comp @@ -2,11 +2,11 @@ component updown "Counts up or down, with optional limits and wraparound behavio pin in bool countup "Increment count when this pin goes from 0 to 1"; pin in bool countdown "Decrement count when this pin goes from 0 to 1"; pin in bool reset "Reset count when this pin goes from 0 to 1"; -pin out si32 count "The current count"; +pin out sint count "The current count"; param rw bool clamp_ "If TRUE, then clamp the output to the min and max parameters."; param rw bool wrap "If TRUE, then wrap around when the count goes above or below the min and max parameters. Note that wrap implies (and overrides) clamp."; -param rw si32 max_ = 0x7FFFFFFF "If clamp or wrap is set, count will never exceed this number"; -param rw si32 min_ "If clamp or wrap is set, count will never be less than this number"; +param rw sint max_ = 0x7FFFFFFF "If clamp or wrap is set, count will never exceed this number"; +param rw sint min_ "If clamp or wrap is set, count will never be less than this number"; variable int oldup; variable int olddown; variable int first = 1; @@ -18,7 +18,7 @@ author "Stephen Wille Padnos"; ;; FUNCTION(_) { - rtapi_s32 temp_count = count; + rtapi_sint temp_count = count; if (first) { oldup=countup; olddown=countdown; diff --git a/src/hal/components/userkins.comp b/src/hal/components/userkins.comp index a2a25d88c29..5ecf3f2ff20 100644 --- a/src/hal/components/userkins.comp +++ b/src/hal/components/userkins.comp @@ -59,7 +59,7 @@ change all instances of `userkins` to `mykins`. """; // The fpin pin is not accessible in kinematics functions. // Use the *_setup() function for pins and params used by kinematics. -pin out si32 fpin=0"pin to demonstrate use of a conventional (non-kinematics) function fdemo"; +pin out sint fpin=0"pin to demonstrate use of a conventional (non-kinematics) function fdemo"; option period no; function fdemo; license "GPL"; diff --git a/src/hal/components/watchdog.c b/src/hal/components/watchdog.c index 13184352209..4bb7553b3f0 100644 --- a/src/hal/components/watchdog.c +++ b/src/hal/components/watchdog.c @@ -148,14 +148,14 @@ int rtapi_app_main(void) } /* export functions */ - retval = hal_export_funct("watchdog.process", process, inputs, 0, 0, comp_id); + retval = hal_export_funct("watchdog.process", process, inputs, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "WATCHDOG: ERROR: process funct export failed\n"); goto err; } - retval = hal_export_funct("watchdog.set-timeouts", set_timeouts, inputs, 1, 0, comp_id); + retval = hal_export_funct("watchdog.set-timeouts", set_timeouts, inputs, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "WATCHDOG: ERROR: set_timeouts funct export failed\n"); diff --git a/src/hal/components/weighted_sum.c b/src/hal/components/weighted_sum.c index d28b2aa0a26..b65cab3c4a5 100644 --- a/src/hal/components/weighted_sum.c +++ b/src/hal/components/weighted_sum.c @@ -5,9 +5,9 @@ * See the "Users Manual" at emc2/docs/Hal_Introduction.pdf * * This component is a "weighted summer". It has a (user specified) -* number of HAL_BIT input pins, and a HAL_S32 parameter corresponding +* number of HAL_BOOL input pins, and a HAL_SINT parameter corresponding * to each bit input. -* There is one HAL_S32 output. The output value is the sum of the +* There is one HAL_SINT output. The output value is the sum of the * parameters for which the corresponding bit input is true. * * The default value for the parameters is 2^n, where n is the bit number. @@ -144,7 +144,7 @@ int rtapi_app_main(void) } /* export update function */ - retval = hal_export_funct("process_wsums", process_wsums, wsum_array, 1, 0, comp_id); + retval = hal_export_funct("process_wsums", process_wsums, wsum_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "WEIGHTED_SUM: ERROR: process_wsums funct export failed\n"); diff --git a/src/hal/components/xhc_hb04_util.comp b/src/hal/components/xhc_hb04_util.comp index f52a4d04d73..673fb4f11a6 100644 --- a/src/hal/components/xhc_hb04_util.comp +++ b/src/hal/components/xhc_hb04_util.comp @@ -17,14 +17,14 @@ pin out bool resume; pin out bool run; // integer low pass filters (see ilowpass.comp) -pin in si32 in0; -pin in si32 in1; -pin in si32 in2; -pin in si32 in3; -pin out si32 out0; -pin out si32 out1; -pin out si32 out2; -pin out si32 out3; +pin in sint in0; +pin in sint in1; +pin in sint in2; +pin in sint in3; +pin out sint out0; +pin out sint out1; +pin out sint out2; +pin out sint out3; pin in real scale0 = 1.0; pin in real scale1 = 1.0; pin in real scale2 = 1.0; diff --git a/src/hal/components/xyzab_tdr_kins.comp b/src/hal/components/xyzab_tdr_kins.comp index ea9e39839a0..250c194f8dd 100644 --- a/src/hal/components/xyzab_tdr_kins.comp +++ b/src/hal/components/xyzab_tdr_kins.comp @@ -30,7 +30,7 @@ chapter (docs/src/motion/switchkins.txt) """; -pin out si32 dummy=0"one pin needed to satisfy halcompile requirement"; +pin out sint dummy=0"one pin needed to satisfy halcompile requirement"; license "GPL"; author "David Mueller"; diff --git a/src/hal/components/xyzacb_trsrn.comp b/src/hal/components/xyzacb_trsrn.comp index dfbe4466ace..9ad18245083 100644 --- a/src/hal/components/xyzacb_trsrn.comp +++ b/src/hal/components/xyzacb_trsrn.comp @@ -5,7 +5,7 @@ description FIXME """; -pin out si32 dummy=0 "dummy pin to satisfy halcompile"; +pin out sint dummy=0 "dummy pin to satisfy halcompile"; option period no; license "GPL"; diff --git a/src/hal/components/xyzbca_trsrn.comp b/src/hal/components/xyzbca_trsrn.comp index b8f451c17f9..79dc4a621e6 100644 --- a/src/hal/components/xyzbca_trsrn.comp +++ b/src/hal/components/xyzbca_trsrn.comp @@ -5,7 +5,7 @@ description FIXME """; -pin out si32 dummy=0 "dummy pin to satisfy halcompile"; +pin out sint dummy=0 "dummy pin to satisfy halcompile"; option period no; license "GPL"; diff --git a/src/hal/drivers/hal_ax5214h.c b/src/hal/drivers/hal_ax5214h.c index 84dd3781d51..17c10b28fde 100644 --- a/src/hal/drivers/hal_ax5214h.c +++ b/src/hal/drivers/hal_ax5214h.c @@ -236,7 +236,7 @@ int rtapi_app_main(void) for (n = 0; n < num_boards; n++) { /* export read function */ retval = hal_export_functf(read_board, &(board_array[n]), - 0, 0, comp_id, "ax5214h.%d.read", n); + 0, comp_id, "ax5214h.%d.read", n); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "AX5214H: ERROR: port %d read funct export failed\n", n); @@ -245,7 +245,7 @@ int rtapi_app_main(void) } /* export write function */ retval = hal_export_functf(write_board, &(board_array[n]), - 0, 0, comp_id, "ax5214h.%d.write", n); + 0, comp_id, "ax5214h.%d.write", n); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "AX5214H: ERROR: port %d write funct export failed\n", n); diff --git a/src/hal/drivers/hal_bb_gpio.c b/src/hal/drivers/hal_bb_gpio.c index e1a23f3a5e9..d59e78cd306 100644 --- a/src/hal/drivers/hal_bb_gpio.c +++ b/src/hal/drivers/hal_bb_gpio.c @@ -345,14 +345,14 @@ int rtapi_app_main(void) { // export functions - retval = hal_export_funct("bb_gpio.write", write_port, port_data, 0, 0, comp_id); + retval = hal_export_funct("bb_gpio.write", write_port, port_data, 0, comp_id); if(retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "%s: ERROR: port %d write funct export failed\n", modname, n); hal_exit(comp_id); return -1; } - retval = hal_export_funct("bb_gpio.read", read_port, port_data, 0, 0, comp_id); + retval = hal_export_funct("bb_gpio.read", read_port, port_data, 0, comp_id); if(retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "%s: ERROR: port %d read funct export failed\n", modname, n); hal_exit(comp_id); diff --git a/src/hal/drivers/hal_evoreg.c b/src/hal/drivers/hal_evoreg.c index 01c82f992d5..23e8ff52678 100644 --- a/src/hal/drivers/hal_evoreg.c +++ b/src/hal/drivers/hal_evoreg.c @@ -243,7 +243,7 @@ int rtapi_app_main(void) /* STEP 4: export function */ - retval = hal_export_functf(update_port, &(port_data_array[n]), 1, 0, + retval = hal_export_functf(update_port, &(port_data_array[n]), 0, comp_id, "evoreg.%d.update", n + 1); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, diff --git a/src/hal/drivers/hal_gm.c b/src/hal/drivers/hal_gm.c index 5940aa3bc85..0e7b02ccffb 100644 --- a/src/hal/drivers/hal_gm.c +++ b/src/hal/drivers/hal_gm.c @@ -1072,16 +1072,16 @@ static int ExportFunctions(void *arg, int comp_id, int boardId) int error; gm_device_t *device = (gm_device_t *)arg; - error = hal_export_functf(write, device, 1, 0, comp_id, "gm.%d.write", boardId); + error = hal_export_functf(write, device, 0, comp_id, "gm.%d.write", boardId); if(error == 0) { - error = hal_export_functf(read, device, 1, 0, comp_id, "gm.%d.read", boardId); + error = hal_export_functf(read, device, 0, comp_id, "gm.%d.read", boardId); } if(error == 0) { - error = hal_export_functf(RS485, device, 1, 0, comp_id, "gm.%d.RS485", boardId); + error = hal_export_functf(RS485, device, 0, comp_id, "gm.%d.RS485", boardId); } return error; diff --git a/src/hal/drivers/hal_gpio.c b/src/hal/drivers/hal_gpio.c index bcac7c27c02..12e742c908c 100644 --- a/src/hal/drivers/hal_gpio.c +++ b/src/hal/drivers/hal_gpio.c @@ -446,15 +446,15 @@ rtapi_print_msg(RTAPI_MSG_INFO, "Libgpiod is %i\n", LIBGPIOD_VER); } rtapi_snprintf(hal_name, HAL_NAME_LEN, "hal_gpio.read"); - retval += hal_export_funct(hal_name, hal_gpio_read, gpio, 0, 0, comp_id); + retval += hal_export_funct(hal_name, hal_gpio_read, gpio, 0, comp_id); rtapi_snprintf(hal_name, HAL_NAME_LEN, "hal_gpio.write"); - retval += hal_export_funct(hal_name, hal_gpio_write, gpio, 0, 0, comp_id); + retval += hal_export_funct(hal_name, hal_gpio_write, gpio, 0, comp_id); if (reset_active){ gpio->reset_ns = hal_malloc(sizeof(*gpio->reset_ns)); rtapi_snprintf(hal_name, HAL_NAME_LEN, "hal_gpio.reset"); retval += hal_param_new_ui32(comp_id, HAL_RW, gpio->reset_ns, 0, "hal_gpio.reset_ns"); - retval += hal_export_funct(hal_name, hal_gpio_reset, gpio, 0, 0, comp_id); + retval += hal_export_funct(hal_name, hal_gpio_reset, gpio, 0, comp_id); } if (retval < 0){ rtapi_print_msg(RTAPI_MSG_ERR, "hal_gpio: failed to export functions\n"); diff --git a/src/hal/drivers/hal_motenc.c b/src/hal/drivers/hal_motenc.c index 01471f7c679..660e1822e25 100644 --- a/src/hal/drivers/hal_motenc.c +++ b/src/hal/drivers/hal_motenc.c @@ -522,7 +522,7 @@ Device_ExportEncoderPinsParametersFunctions(Device *this, int componentId, int b // Export functions. if(!halError){ - halError = hal_export_functf(Device_EncoderRead, this, 1, 0, componentId, "motenc.%d.encoder-read", boardId); + halError = hal_export_functf(Device_EncoderRead, this, 0, componentId, "motenc.%d.encoder-read", boardId); } if(halError){ @@ -559,7 +559,7 @@ Device_ExportDacPinsParametersFunctions(Device *this, int componentId, int board // Export functions. if(!halError){ - halError = hal_export_functf(Device_DacWrite, this, 1, 0, componentId, "motenc.%d.dac-write", boardId); + halError = hal_export_functf(Device_DacWrite, this, 0, componentId, "motenc.%d.dac-write", boardId); } if(halError){ @@ -596,7 +596,7 @@ Device_ExportAdcPinsParametersFunctions(Device *this, int componentId, int board // Export functions. if(!halError){ - halError = hal_export_functf(Device_AdcRead, this, 1, 0, componentId, "motenc.%d.adc-read", boardId); + halError = hal_export_functf(Device_AdcRead, this, 0, componentId, "motenc.%d.adc-read", boardId); } if(halError){ @@ -628,7 +628,7 @@ Device_ExportDigitalInPinsParametersFunctions(Device *this, int componentId, int // Export functions. if(!halError){ - halError = hal_export_functf(Device_DigitalInRead, this, 0, 0, componentId, "motenc.%d.digital-in-read", boardId); + halError = hal_export_functf(Device_DigitalInRead, this, 0, componentId, "motenc.%d.digital-in-read", boardId); } if(halError){ @@ -661,7 +661,7 @@ Device_ExportDigitalOutPinsParametersFunctions(Device *this, int componentId, in // Export functions. if(!halError){ - halError = hal_export_functf(Device_DigitalOutWrite, this, 0, 0, componentId, "motenc.%d.digital-out-write", boardId); + halError = hal_export_functf(Device_DigitalOutWrite, this, 0, componentId, "motenc.%d.digital-out-write", boardId); } if(halError){ @@ -700,7 +700,7 @@ Device_ExportMiscPinsParametersFunctions(Device *this, int componentId, int boar // Export functions. if(!halError){ - halError = hal_export_functf(Device_MiscUpdate, this, 0, 0, componentId, "motenc.%d.misc-update", boardId); + halError = hal_export_functf(Device_MiscUpdate, this, 0, componentId, "motenc.%d.misc-update", boardId); } if(halError){ diff --git a/src/hal/drivers/hal_parport.c b/src/hal/drivers/hal_parport.c index 3e4c43f4ca4..f704febee99 100644 --- a/src/hal/drivers/hal_parport.c +++ b/src/hal/drivers/hal_parport.c @@ -239,7 +239,7 @@ rtapi_print ( "config string '%s'\n", cfg ); for (n = 0; n < num_ports; n++) { /* export read function */ retval = hal_export_functf(read_port, &(port_data_array[n]), - 0, 0, comp_id, "parport.%d.read", n); + 0, comp_id, "parport.%d.read", n); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PARPORT: ERROR: port %d read funct export failed\n", n); @@ -248,7 +248,7 @@ rtapi_print ( "config string '%s'\n", cfg ); } /* export write function */ retval = hal_export_functf(write_port, &(port_data_array[n]), - 0, 0, comp_id, "parport.%d.write", n); + 0, comp_id, "parport.%d.write", n); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PARPORT: ERROR: port %d write funct export failed\n", n); @@ -257,7 +257,7 @@ rtapi_print ( "config string '%s'\n", cfg ); } /* export write function */ retval = hal_export_functf(reset_port, &(port_data_array[n]), - 0, 0, comp_id, "parport.%d.reset", n); + 0, comp_id, "parport.%d.reset", n); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PARPORT: ERROR: port %d reset funct export failed\n", n); @@ -267,7 +267,7 @@ rtapi_print ( "config string '%s'\n", cfg ); } /* export functions that read and write all ports */ retval = hal_export_funct("parport.read-all", read_all, - port_data_array, 0, 0, comp_id); + port_data_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PARPORT: ERROR: read all funct export failed\n"); @@ -275,7 +275,7 @@ rtapi_print ( "config string '%s'\n", cfg ); return -1; } retval = hal_export_funct("parport.write-all", write_all, - port_data_array, 0, 0, comp_id); + port_data_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PARPORT: ERROR: write all funct export failed\n"); diff --git a/src/hal/drivers/hal_pi_gpio.c b/src/hal/drivers/hal_pi_gpio.c index 3c4abeb3c53..10e6071ab78 100644 --- a/src/hal/drivers/hal_pi_gpio.c +++ b/src/hal/drivers/hal_pi_gpio.c @@ -330,16 +330,14 @@ int rtapi_app_main(void) return -1; } - retval = hal_export_funct("hal_pi_gpio.write", write_port, 0, - 0, 0, comp_id); + retval = hal_export_funct("hal_pi_gpio.write", write_port, 0, 0, comp_id); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "HAL_PI_GPIO: ERROR: write funct export failed\n"); hal_exit(comp_id); return -1; } - retval = hal_export_funct("hal_pi_gpio.read", read_port, 0, - 0, 0, comp_id); + retval = hal_export_funct("hal_pi_gpio.read", read_port, 0, 0, comp_id); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "HAL_PI_GPIO: ERROR: read funct export failed\n"); diff --git a/src/hal/drivers/hal_ppmc.c b/src/hal/drivers/hal_ppmc.c index 89b3a259753..3d3e9981ade 100644 --- a/src/hal/drivers/hal_ppmc.c +++ b/src/hal/drivers/hal_ppmc.c @@ -732,7 +732,7 @@ int rtapi_app_main(void) } /* export functions */ rv1 = hal_export_functf(read_all, &(bus_array[busnum]), - 1, 0, comp_id, "ppmc.%d.read", busnum); + 0, comp_id, "ppmc.%d.read", busnum); if (rv1 != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PPMC: ERROR: read funct export failed\n"); @@ -741,7 +741,7 @@ int rtapi_app_main(void) continue; } rv1 = hal_export_functf(write_all, &(bus_array[busnum]), - 1, 0, comp_id, "ppmc.%d.write", busnum); + 0, comp_id, "ppmc.%d.write", busnum); if (rv1 != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PPMC: ERROR: write funct export failed\n"); diff --git a/src/hal/drivers/hal_skeleton.c b/src/hal/drivers/hal_skeleton.c index 2496f066152..e1d9c064736 100644 --- a/src/hal/drivers/hal_skeleton.c +++ b/src/hal/drivers/hal_skeleton.c @@ -172,7 +172,7 @@ int rtapi_app_main(void) } /* STEP 4: export write function */ - retval = hal_export_functf(write_port, &(port_data_array[n]), 0, 0, + retval = hal_export_functf(write_port, &(port_data_array[n]), 0, comp_id, "skeleton.%d.write", n); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, diff --git a/src/hal/drivers/hal_speaker.c b/src/hal/drivers/hal_speaker.c index c4e30db1abd..d649cf1fddb 100644 --- a/src/hal/drivers/hal_speaker.c +++ b/src/hal/drivers/hal_speaker.c @@ -194,7 +194,7 @@ int rtapi_app_main(void) /* STEP 4: export write function */ retval = - hal_export_functf(write_port, &(port_data_array[n]), 0, 0, + hal_export_functf(write_port, &(port_data_array[n]), 0, comp_id, "speaker.%d.write", n); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, diff --git a/src/hal/drivers/hal_stg.c b/src/hal/drivers/hal_stg.c index 95d2c5c1766..9ec3838e2bf 100644 --- a/src/hal/drivers/hal_stg.c +++ b/src/hal/drivers/hal_stg.c @@ -413,7 +413,7 @@ int rtapi_app_main(void) /* export functions */ retval = hal_export_funct("stg.capture-position", stg_counter_capture, - stg_driver, 1, 0, comp_id); + stg_driver, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "STG: ERROR: stg.counter-capture funct export failed\n"); @@ -424,7 +424,7 @@ int rtapi_app_main(void) "STG: installed %d encoder counters\n", num_chan); retval = hal_export_funct("stg.write-dacs", stg_dacs_write, - stg_driver, 1, 0, comp_id); + stg_driver, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "STG: ERROR: stg.write-dacs funct export failed\n"); @@ -435,7 +435,7 @@ int rtapi_app_main(void) "STG: installed %d dacs\n", num_chan); retval = hal_export_funct("stg.read-adcs", stg_adcs_read, - stg_driver, 1, 0, comp_id); + stg_driver, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "STG: ERROR: stg.read-adcs funct export failed\n"); @@ -446,7 +446,7 @@ int rtapi_app_main(void) "STG: installed %d adcs\n", num_chan); retval = hal_export_funct("stg.di-read", stg_di_read, - stg_driver, 0, 0, comp_id); + stg_driver, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "STG: ERROR: stg.di-read funct export failed\n"); @@ -458,7 +458,7 @@ int rtapi_app_main(void) "STG: installed %d digital inputs\n", inputpinnum); retval = hal_export_funct("stg.do-write", stg_do_write, - stg_driver, 0, 0, comp_id); + stg_driver, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "STG: ERROR: stg.do-write funct export failed\n"); @@ -469,7 +469,7 @@ int rtapi_app_main(void) "STG: installed %d digital outputs\n", outpinnum); /* - retval = hal_export_funct("stg.debug_print", stg_debug_print, stg_driver, 0, 0, comp_id); + retval = hal_export_funct("stg.debug_print", stg_debug_print, stg_driver, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, diff --git a/src/hal/drivers/hal_tiro.c b/src/hal/drivers/hal_tiro.c index eba33782d3a..046799b979a 100644 --- a/src/hal/drivers/hal_tiro.c +++ b/src/hal/drivers/hal_tiro.c @@ -158,7 +158,7 @@ int rtapi_app_main(void) } /* export functions */ retval = hal_export_funct("tiro.capture-position", capture, - counter_array, 1, 0, comp_id); + counter_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "TIRO: ERROR: capture funct export failed\n"); diff --git a/src/hal/drivers/hal_vti.c b/src/hal/drivers/hal_vti.c index 7f5cb7c7ce8..4777e63b213 100644 --- a/src/hal/drivers/hal_vti.c +++ b/src/hal/drivers/hal_vti.c @@ -338,7 +338,7 @@ int rtapi_app_main(void) /* export functions */ retval = hal_export_funct("vti.capture-position", vti_counter_capture, - vti_driver, 1, 0, comp_id); + vti_driver, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "VTI: ERROR: vti.counter-capture funct export failed\n"); @@ -349,7 +349,7 @@ int rtapi_app_main(void) "VTI: installed %d encoder counters\n", num_chan); retval = hal_export_funct("vti.write-dacs", vti_dacs_write, - vti_driver, 1, 0, comp_id); + vti_driver, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "VTI: ERROR: vti.write-dacs funct export failed\n"); @@ -359,7 +359,7 @@ int rtapi_app_main(void) rtapi_print_msg(RTAPI_MSG_INFO, "VTI: installed %d dacs\n", num_chan); retval = hal_export_funct("vti.read-adcs", vti_adcs_read, - vti_driver, 1, 0, comp_id); + vti_driver, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "VTI: ERROR: vti.read-adcs funct export failed\n"); @@ -369,7 +369,7 @@ int rtapi_app_main(void) rtapi_print_msg(RTAPI_MSG_INFO, "VTI: installed %d adcs\n", 0); retval = hal_export_funct("vti.di-read", vti_di_read, - vti_driver, 0, 0, comp_id); + vti_driver, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "VTI: ERROR: vti.di-read funct export failed\n"); @@ -381,7 +381,7 @@ int rtapi_app_main(void) "VTI: installed %d digital inputs\n", inputpinnum); retval = hal_export_funct("vti.do-write", vti_do_write, - vti_driver, 0, 0, comp_id); + vti_driver, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "VTI: ERROR: vti.do-write funct export failed\n"); diff --git a/src/hal/drivers/mesa-hostmot2/abs_encoder.c b/src/hal/drivers/mesa-hostmot2/abs_encoder.c index 73ded3dab18..5b7b954bbb9 100644 --- a/src/hal/drivers/mesa-hostmot2/abs_encoder.c +++ b/src/hal/drivers/mesa-hostmot2/abs_encoder.c @@ -126,7 +126,7 @@ int hm2_absenc_register_tram(hostmot2_t *hm2){ if (hm2->config.num_dplls == 0){ hal_export_functf(hm2_absenc_trigger, - hm2, 0, 0,hm2->llio->comp_id, "%s.trigger-encoders", hm2->llio->name); + hm2, 0, hm2->llio->comp_id, "%s.trigger-encoders", hm2->llio->name); funct_flag = true; } diff --git a/src/hal/drivers/mesa-hostmot2/hm2_eth.c b/src/hal/drivers/mesa-hostmot2/hm2_eth.c index 5dbf3cfae9a..76766382041 100644 --- a/src/hal/drivers/mesa-hostmot2/hm2_eth.c +++ b/src/hal/drivers/mesa-hostmot2/hm2_eth.c @@ -1712,7 +1712,7 @@ int rtapi_app_main(void) { *added = 1; } - hal_export_functf(init_board_realtime_all, 0, 0, 0, comp_id, "%s.realtime-init", HM2_LLIO_NAME); + hal_export_functf(init_board_realtime_all, 0, 0, comp_id, "%s.realtime-init", HM2_LLIO_NAME); hal_ready(comp_id); diff --git a/src/hal/drivers/mesa-hostmot2/hm2_modbus.c b/src/hal/drivers/mesa-hostmot2/hm2_modbus.c index 251bfef219d..01b982cc5e9 100644 --- a/src/hal/drivers/mesa-hostmot2/hm2_modbus.c +++ b/src/hal/drivers/mesa-hostmot2/hm2_modbus.c @@ -1459,13 +1459,6 @@ static int build_data_frame(hm2_modbus_inst_t *inst) case HAL_BOOL: CHK_RV(map_u(cc, hal_get_bool(hal->pins[p].pin.b) ? 1 : 0, 0)); break; - case HAL_U32: - switch(mtypetype(cc->typeptr[0].mtype)) { - case MBT_U: CHK_RV(map_u(cc, hal_get_ui32(hal->pins[p].pin.u), 0)); break; - case MBT_S: CHK_RV(map_s(cc, map_us(hal_get_ui32(hal->pins[p].pin.u)), 0)); break; - case MBT_F: CHK_RV(map_f(cc, map_uf(hal_get_ui32(hal->pins[p].pin.u)), 0)); break; - } - break; case HAL_UINT: switch(mtypetype(cc->typeptr[0].mtype)) { case MBT_U: CHK_RV(map_u(cc, hal_get_uint(hal->pins[p].pin.u), 0)); break; @@ -1473,22 +1466,6 @@ static int build_data_frame(hm2_modbus_inst_t *inst) case MBT_F: CHK_RV(map_f(cc, map_uf(hal_get_uint(hal->pins[p].pin.u)), 0)); break; } break; - case HAL_S32: - if(!haspinscale(&cc->typeptr[0])) { - switch(mtypetype(cc->typeptr[0].mtype)) { - case MBT_U: CHK_RV(map_u(cc, map_su(hal_get_si32(hal->pins[p].pin.s)), 0)); break; - case MBT_S: CHK_RV(map_s(cc, hal_get_si32(hal->pins[p].pin.s), 0)); break; - case MBT_F: CHK_RV(map_f(cc, map_sf(hal_get_si32(hal->pins[p].pin.s)), 0)); break; - } - } else { - val64.f = (rtapi_real)((rtapi_s64)hal_get_si32(hal->pins[p].pin.s) - hal_get_si32(hal->pins[p].offset.s)) * hal_get_real(hal->pins[p].scale); - switch(mtypetype(cc->typeptr[0].mtype)) { - case MBT_U: CHK_RV(map_u(cc, map_fu(val64.f), 0)); break; - case MBT_S: CHK_RV(map_s(cc, map_fs(val64.f), 0)); break; - case MBT_F: CHK_RV(map_f(cc, val64.f, 0)); break; - } - } - break; case HAL_SINT: if(!haspinscale(&cc->typeptr[0])) { switch(mtypetype(cc->typeptr[0].mtype)) { @@ -1555,13 +1532,6 @@ static int build_data_frame(hm2_modbus_inst_t *inst) case HAL_BOOL: CHK_RV(map_u(cc, hal_get_bool(hal->pins[p].pin.b) ? 1 : 0, i)); break; - case HAL_U32: - switch(mtypetype(cc->typeptr[i].mtype)) { - case MBT_U: CHK_RV(map_u(cc, hal_get_ui32(hal->pins[p].pin.u), i)); break; - case MBT_S: CHK_RV(map_s(cc, map_us(hal_get_ui32(hal->pins[p].pin.u)), i)); break; - case MBT_F: CHK_RV(map_f(cc, map_uf(hal_get_ui32(hal->pins[p].pin.u)), i)); break; - } - break; case HAL_UINT: switch(mtypetype(cc->typeptr[i].mtype)) { case MBT_U: CHK_RV(map_u(cc, hal_get_uint(hal->pins[p].pin.u), i)); break; @@ -1569,22 +1539,6 @@ static int build_data_frame(hm2_modbus_inst_t *inst) case MBT_F: CHK_RV(map_f(cc, map_uf(hal_get_uint(hal->pins[p].pin.u)), i)); break; } break; - case HAL_S32: - if(!haspinscale(&cc->typeptr[i])) { - switch(mtypetype(cc->typeptr[i].mtype)) { - case MBT_U: CHK_RV(map_u(cc, map_su(hal_get_si32(hal->pins[p].pin.s)), i)); break; - case MBT_S: CHK_RV(map_s(cc, hal_get_si32(hal->pins[p].pin.s), i)); break; - case MBT_F: CHK_RV(map_f(cc, map_sf(hal_get_si32(hal->pins[p].pin.s)), i)); break; - } - } else { - val64.f = (rtapi_real)((rtapi_s64)hal_get_si32(hal->pins[p].pin.s) - hal_get_si32(hal->pins[p].offset.s)) * hal_get_real(hal->pins[p].scale); - switch(mtypetype(cc->typeptr[i].mtype)) { - case MBT_U: CHK_RV(map_u(cc, map_fu(val64.f), i)); break; - case MBT_S: CHK_RV(map_s(cc, map_fs(val64.f), i)); break; - case MBT_F: CHK_RV(map_f(cc, val64.f, i)); break; - } - } - break; case HAL_SINT: if(!haspinscale(&cc->typeptr[i])) { switch(mtypetype(cc->typeptr[i].mtype)) { @@ -1700,56 +1654,6 @@ static inline rtapi_u64 mask_mbtsize(unsigned mtype, rtapi_u64 v) } } -static inline rtapi_u32 unmap32_uu(const hm2_modbus_cmd_t *cc, rtapi_u64 v, unsigned tidx) -{ - if(haspinclamp(&cc->typeptr[tidx]) && v > RTAPI_UINT32_MAX) - return RTAPI_UINT32_MAX; - return (rtapi_u32)v; -} - -static inline rtapi_u32 unmap32_us(const hm2_modbus_cmd_t *cc, rtapi_s64 v, unsigned tidx) -{ - if(haspinclamp(&cc->typeptr[tidx])) { - if(v > RTAPI_INT32_MAX) return RTAPI_INT32_MAX; - if(v < 0) return 0; - } - return (rtapi_u32)v; -} - -static inline rtapi_u32 unmap32_uf(const hm2_modbus_cmd_t *cc, double v, unsigned tidx) -{ - if(haspinclamp(&cc->typeptr[tidx])) { - if(v > (double)RTAPI_INT32_MAX) return RTAPI_INT32_MAX; - if(v < 0.0) return 0; - } - return (rtapi_u32)v; -} - -static inline rtapi_s32 unmap32_su(const hm2_modbus_cmd_t *cc, rtapi_u64 v, unsigned tidx) -{ - if(haspinclamp(&cc->typeptr[tidx]) && v > (rtapi_u64)RTAPI_INT32_MAX) - return RTAPI_INT32_MAX; - return (rtapi_s32)v; -} - -static inline rtapi_s32 unmap32_ss(const hm2_modbus_cmd_t *cc, rtapi_s64 v, unsigned tidx) -{ - if(haspinclamp(&cc->typeptr[tidx])) { - if(v > (rtapi_s64)RTAPI_INT32_MAX) return RTAPI_INT32_MAX; - if(v < (rtapi_s64)RTAPI_INT32_MIN) return RTAPI_INT32_MIN; - } - return (rtapi_s32)v; -} - -static inline rtapi_s32 unmap32_sf(const hm2_modbus_cmd_t *cc, double v, unsigned tidx) -{ - if(haspinclamp(&cc->typeptr[tidx])) { - if(v > (double)RTAPI_INT32_MAX) return RTAPI_INT32_MAX; - if(v < (double)RTAPI_INT32_MIN) return RTAPI_INT32_MIN; - } - return (rtapi_s32)v; -} - static inline rtapi_u64 unmap64_us(const hm2_modbus_cmd_t *cc, rtapi_s64 v, unsigned tidx) { if(haspinclamp(&cc->typeptr[tidx]) && v < 0) @@ -1973,27 +1877,6 @@ static int parse_data_frame(hm2_modbus_inst_t *inst) case HAL_BOOL: hal_set_bool(hal->pins[p].pin.b, 0 != val64.u); // Zero maps to false, anything else to true break; - case HAL_U32: - switch(mtypetype(cc->typeptr[i].mtype)) { - case MBT_U: hal_set_ui32(hal->pins[p].pin.u, unmap32_uu(cc, val64.u, i)); break; - case MBT_S: hal_set_ui32(hal->pins[p].pin.u, unmap32_us(cc, val64.s, i)); break; - case MBT_F: hal_set_ui32(hal->pins[p].pin.u, unmap32_uf(cc, val64.f, i)); break; - } - break; - case HAL_S32: - switch(mtypetype(cc->typeptr[i].mtype)) { - case MBT_U: hal_set_si32(hal->pins[p].pin.s, unmap32_su(cc, val64.u, i)); break; - case MBT_S: hal_set_si32(hal->pins[p].pin.s, unmap32_ss(cc, val64.s, i)); break; - case MBT_F: hal_set_si32(hal->pins[p].pin.s, unmap32_sf(cc, val64.f, i)); break; - } - if(haspinscale(&cc->typeptr[i])) { - switch(mtypetype(cc->typeptr[i].mtype)) { - case MBT_U: hal_set_real(hal->pins[p].scaled, (rtapi_real)(rtapi_s64)(val64.u - hal_get_uint(hal->pins[p].offset.u)) * hal_get_real(hal->pins[p].scale)); break; - case MBT_S: hal_set_real(hal->pins[p].scaled, (rtapi_real)(val64.s - hal_get_sint(hal->pins[p].offset.s)) * hal_get_real(hal->pins[p].scale)); break; - case MBT_F: hal_set_real(hal->pins[p].scaled, (val64.f - hal_get_real(hal->pins[p].offset.r)) * hal_get_real(hal->pins[p].scale)); break; - } - } - break; case HAL_UINT: switch(mtypetype(cc->typeptr[i].mtype)) { case MBT_U: hal_set_uint(hal->pins[p].pin.u, val64.u); break; @@ -2260,8 +2143,6 @@ static int check_htype(unsigned type) { switch(type) { case HAL_BOOL: // not valid in register read/write - case HAL_U32: - case HAL_S32: case HAL_UINT: case HAL_SINT: case HAL_REAL: @@ -2289,13 +2170,13 @@ static int load_mbccb(hm2_modbus_inst_t *inst, const char *fname) } // Done reading, now test format - static const rtapi_u8 signature[8] = {'M','e','s','a','M','B','0','1'}; + static const rtapi_u8 signature[8] = {'M','e','s','a','M','B','0','2'}; if(memcmp(signature, mbccb->sig, sizeof(signature))) { char buf[sizeof(mbccb->sig)+1]; for(unsigned i = 0; i < sizeof(mbccb->sig); i++) buf[i] = isprint(mbccb->sig[i]) ? mbccb->sig[i] : '?'; buf[sizeof(mbccb->sig)] = 0; - MSG_ERR("%s: error: Invalid signature in mbccb file: '%s' (expected 'MesaMB01')\n", inst->name, buf); + MSG_ERR("%s: error: Invalid signature in mbccb file: '%s' (expected 'MesaMB02')\n", inst->name, buf); MSG_ERR("%s: error: Have you compiled the mbccs source into a binary mbccb file using mesambccc?\n", inst->name); goto errout; } @@ -2805,7 +2686,7 @@ int rtapi_app_main(void) inst->cmds = inst->ninit ? inst->_init : inst->_cmds; // Export the HAL process function - if((retval = hal_export_functf(process, inst, 1, 0, comp_id, COMP_NAME".%d.process", i)) < 0) { + if((retval = hal_export_functf(process, inst, 0, comp_id, COMP_NAME".%d.process", i)) < 0) { MSG_ERR("%s: error: Function export failed\n", inst->name); goto errout; } @@ -2997,46 +2878,11 @@ int rtapi_app_main(void) 0, "%s.%s", inst->name, CPTR(dptr))); break; - case HAL_U32: - CHECK(hal_pin_new_ui32(comp_id, dir, &(inst->hal->pins[p++].pin.u), - 0, "%s.%s", inst->name, CPTR(dptr))); - break; - case HAL_UINT: CHECK(hal_pin_new_uint(comp_id, dir, &(inst->hal->pins[p++].pin.u), 0, "%s.%s", inst->name, CPTR(dptr))); break; - case HAL_S32: - CHECK(hal_pin_new_si32(comp_id, dir, &(inst->hal->pins[p].pin.s), - 0, "%s.%s", inst->name, CPTR(dptr))); - if(haspinscale(&cc->typeptr[j])) { - CHECK(hal_pin_new_real(comp_id, HAL_IN, &(inst->hal->pins[p].scale), - 1.0, "%s.%s.scale", inst->name, CPTR(dptr))); - if(HAL_OUT == dir) { - CHECK(hal_pin_new_real(comp_id, HAL_OUT, &(inst->hal->pins[p].scaled), - 0.0, "%s.%s.scaled", inst->name, CPTR(dptr))); - switch(mtypetype(cc->typeptr[j].mtype)) { - case MBT_U: - CHECK(hal_pin_new_uint(comp_id, HAL_IN, &(inst->hal->pins[p].offset.u), - 0, "%s.%s.offset", inst->name, CPTR(dptr))); - break; - case MBT_S: - CHECK(hal_pin_new_sint(comp_id, HAL_IN, &(inst->hal->pins[p].offset.s), - 0, "%s.%s.offset", inst->name, CPTR(dptr))); - break; - case MBT_F: - CHECK(hal_pin_new_real(comp_id, HAL_IN, &(inst->hal->pins[p].offset.r), - 0.0, "%s.%s.offset", inst->name, CPTR(dptr))); - break; - } - } else { - CHECK(hal_pin_new_si32(comp_id, HAL_IN, &(inst->hal->pins[p].offset.s), - 0, "%s.%s.offset", inst->name, CPTR(dptr))); - } - } - p++; - break; case HAL_SINT: CHECK(hal_pin_new_sint(comp_id, dir, &(inst->hal->pins[p].pin.s), 0, "%s.%s", inst->name, CPTR(dptr))); diff --git a/src/hal/drivers/mesa-hostmot2/hostmot2.c b/src/hal/drivers/mesa-hostmot2/hostmot2.c index 488f5e3cdc8..f83e48fad84 100644 --- a/src/hal/drivers/mesa-hostmot2/hostmot2.c +++ b/src/hal/drivers/mesa-hostmot2/hostmot2.c @@ -1694,21 +1694,21 @@ int hm2_register(hm2_lowlevel_io_t *llio, char *config_string) { { if(hm2->llio->split_read) { - r = hal_export_functf(hm2_read_request, hm2, 1, 0, hm2->llio->comp_id, "%s.read-request", hm2->llio->name); + r = hal_export_functf(hm2_read_request, hm2, 0, hm2->llio->comp_id, "%s.read-request", hm2->llio->name); if (r != 0) { HM2_ERR("error %d exporting read function %s.read-request\n", r, hm2->llio->name); r = -EINVAL; goto fail1; } } - r = hal_export_functf(hm2_read, hm2, 1, 0, hm2->llio->comp_id, "%s.read", hm2->llio->name); + r = hal_export_functf(hm2_read, hm2, 0, hm2->llio->comp_id, "%s.read", hm2->llio->name); if (r != 0) { HM2_ERR("error %d exporting read function %s.read\n", r, hm2->llio->name); r = -EINVAL; goto fail1; } - r = hal_export_functf(hm2_write, hm2, 1, 0, hm2->llio->comp_id, "%s.write", hm2->llio->name); + r = hal_export_functf(hm2_write, hm2, 0, hm2->llio->comp_id, "%s.write", hm2->llio->name); if (r != 0) { HM2_ERR("error %d exporting write function %s.write\n", r, hm2->llio->name); r = -EINVAL; @@ -1722,14 +1722,14 @@ int hm2_register(hm2_lowlevel_io_t *llio, char *config_string) { // if (hm2->llio->threadsafe) { - r = hal_export_functf(hm2_read_gpio, hm2, 1, 0, hm2->llio->comp_id, "%s.read_gpio", hm2->llio->name); + r = hal_export_functf(hm2_read_gpio, hm2, 0, hm2->llio->comp_id, "%s.read_gpio", hm2->llio->name); if (r != 0) { HM2_ERR("error %d exporting gpio_read function %s.read_gpio\n", r, hm2->llio->name); r = -EINVAL; goto fail1; } - r = hal_export_functf(hm2_write_gpio, hm2, 1, 0, hm2->llio->comp_id, "%s.write_gpio", hm2->llio->name); + r = hal_export_functf(hm2_write_gpio, hm2, 0, hm2->llio->comp_id, "%s.write_gpio", hm2->llio->name); if (r != 0) { HM2_ERR("error %d exporting gpio_write function %s.write_gpio\n", r, hm2->llio->name); r = -EINVAL; diff --git a/src/hal/drivers/mesa-hostmot2/mesambccc.py b/src/hal/drivers/mesa-hostmot2/mesambccc.py index e03dfbca16f..3bfacd91333 100644 --- a/src/hal/drivers/mesa-hostmot2/mesambccc.py +++ b/src/hal/drivers/mesa-hostmot2/mesambccc.py @@ -57,6 +57,7 @@ import xml.parsers.expat as XP import re import struct +import hal # HAL names are a bit picky # The following allows, for example, device names "xyz" but also "xyz.0" and @@ -131,14 +132,11 @@ 'writeflush': [0, 1], 'timeout' : [10000, 10000000] } # 10 milliseconds to 10 seconds (can override in ) -# XXX: Keep in sync with hal.h -HAL_BIT = 1 -HAL_FLT = 2 # HAL_FLOAT -HAL_S32 = 3 -HAL_U32 = 4 -HAL_PRT = 5 # HAL_PORT, unused -HAL_S64 = 6 -HAL_U64 = 7 +# Kept in sync with hal.h via halmodule's IntEnum +HAL_BOOL = hal.Type.BOOL +HAL_REAL = hal.Type.REAL +HAL_SINT = hal.Type.SINT +HAL_UINT = hal.Type.UINT # XXX: Keep in sync with hm2_modbus.c MBT_AB = 0x00 @@ -199,18 +197,23 @@ def mbtType(mtype): F_DCBA = MBT_F | MBT_DCBA # Possible values of the 'haltype' attribute -HALTYPES = { 'HAL_BIT': HAL_BIT, 'HAL_FLOAT': HAL_FLT, 'HAL_FLT': HAL_FLT, - 'HAL_S32': HAL_S32, 'HAL_U32': HAL_U32, - 'HAL_S64': HAL_S64, 'HAL_U64': HAL_U64, +HALTYPES = { 'HAL_BOOL':HAL_BOOL, 'HAL_REAL': HAL_REAL, + 'HAL_SINT':HAL_SINT, 'HAL_UINT': HAL_UINT, + 'HAL_BIT': HAL_BOOL, 'HAL_FLOAT': HAL_REAL, 'HAL_FLT': HAL_REAL, + 'HAL_S32': HAL_SINT, 'HAL_U32': HAL_UINT, + 'HAL_S64': HAL_SINT, 'HAL_U64': HAL_UINT, # Be nice, allow types without useless prefix - 'BIT': HAL_BIT, 'FLOAT': HAL_FLT, 'FLT': HAL_FLT, - 'S32': HAL_S32, 'U32': HAL_U32, - 'S64': HAL_S64, 'U64': HAL_U64 } + 'BOOL': HAL_BOOL, 'REAL': HAL_REAL, + 'SINT': HAL_SINT, 'UINT': HAL_UINT, + 'BIT': HAL_BOOL, 'FLOAT': HAL_REAL, 'FLT': HAL_REAL, + 'S32': HAL_SINT, 'U32': HAL_UINT, + 'S64': HAL_SINT, 'U64': HAL_UINT } + +HALTYPES32 = ['HAL_S32', 'HAL_U32', 'S32', 'U32'] # Reverse map of HALTYPES -HALNAMES = { HAL_BIT: 'HAL_BIT', HAL_FLT: 'HAL_FLOAT', - HAL_S32: 'HAL_S32', HAL_U32: 'HAL_U32', - HAL_S64: 'HAL_S64', HAL_U64: 'HAL_U64' } +HALNAMES = { HAL_BOOL: 'HAL_BOOL', HAL_REAL: 'HAL_REAL', + HAL_SINT: 'HAL_SINT', HAL_UINT: 'HAL_UINT' } # Possible values of the 'modbustype' attribute # [typeId, maxCount, nWords] @@ -288,7 +291,7 @@ def mbtType(mtype): WRITEFUNCTIONS = [ W_COIL, W_REGISTER, W_COILS, W_REGISTERS ] -# These functions always use HAL_BIT +# These functions always use HAL_BOOL # Also, the function is a register function if /not/ in this set BITFUNCTIONS = [R_COILS, R_INPUTS, W_COIL, W_COILS] REGFUNCTIONS = [R_REGISTERS, R_INPUTREGS, W_REGISTER, W_REGISTERS] @@ -469,11 +472,11 @@ def mangle64(d, mtype): def getBoolean(attrib, name): if name not in attrib: return None + BOOLMAP = {'T': True, 'TRUE': True, '1': True, 'ON': True, 'YES': True, + 'F': False, 'FALSE': False, '0': False, 'OFF': False, 'NO': False } a = attrib[name].upper() - if 'T' == a or 'TRUE' == a or '1' == a: - return True - if 'F' == a or 'FALSE' == a or '0' == a: - return False + if a in BOOLMAP: + return BOOLMAP[a] perr("Expected boolean value in '{}' attribute, not '{}'".format(name, attrib[name])) return None @@ -1076,6 +1079,8 @@ def getHalType(tag, ers): if ht not in HALTYPES: perr("Invalid haltype '{}' in {}".format(tag.attrib['haltype'], ers)) return None + if ht in HALTYPES32: + pwarn(f"32-bit haltype '{ht}' will still create 64-bit pins, please update your mbccs file.") return HALTYPES[ht]; # @@ -1154,13 +1159,13 @@ def handleCommands(commands): count = 0 if function in BITFUNCTIONS: - # Coils and inputs are binary and always map to HAL_BIT + # Coils and inputs are binary and always map to HAL_BOOL if 'modbustype' in cmd.attrib: pwarn("Attribute 'modbustype' ignored for bit functions in {}".format(lcl)) if 'haltype' in cmd.attrib: - pwarn("Attribute 'haltype' ignored for bit functions (always HAL_BIT) in {}".format(lcl)) + pwarn("Attribute 'haltype' ignored for bit functions (always HAL_BOOL) in {}".format(lcl)) defmtype = [-1, 2000, 1] # fake mtype - defhtype = HAL_BIT + defhtype = HAL_BOOL else: # These are defaults for R_REGISTERS, R_INPUTREGS, W_REGISTER and W_REGISTERS defmtype = getModbusType(cmd, lcl) @@ -1176,7 +1181,7 @@ def handleCommands(commands): # clamp is default on all pins # writeflush depends on global setting defcflag = MBCCB_CMDF_WFLUSH if configparams['writeflush'] else 0 - defpflag = MBCCB_PINF_SCALE if defhtype == HAL_FLT else 0 + defpflag = MBCCB_PINF_SCALE if defhtype == HAL_REAL else 0 defpflag |= MBCCB_PINF_CLAMP if function in REGFUNCTIONS else 0 cflags, pflags = parseOptFlags(device, cmd.attrib, defcflag, defpflag, lcl) if 0 != cflags & ~MBCCB_CMDF_MASK: @@ -1184,20 +1189,16 @@ def handleCommands(commands): if 0 != pflags & ~MBCCB_PINF_MASK: pwarn("Additional pin flags '0x{:04x}' (allowed=0x{:04x}) in {}".format(pflags, MBCCB_PINF_MASK, lcl)) - if (pflags & MBCCB_PINF_SCALE) and defhtype in [HAL_U32, HAL_U64]: + if (pflags & MBCCB_PINF_SCALE) and defhtype in [HAL_UINT]: pwarn("Unsigned hal types cannot be scaled, disabling in {}".format(lcl)) pflags &= ~MBCCB_PINF_SCALE & 0xffff if None != defmtype and ((0 == (pflags & MBCCB_PINF_SCALE)) and - ((MBT_S == mbtType(defmtype[0]) and defhtype in [HAL_U32, HAL_U64]) - or (MBT_U == mbtType(defmtype[0]) and defhtype in [HAL_S32, HAL_S64]))): + ((MBT_S == mbtType(defmtype[0]) and defhtype in [HAL_UINT]) + or (MBT_U == mbtType(defmtype[0]) and defhtype in [HAL_SINT]))): pwarn("Signedness mismatch between haltype={} and modbustype={} may give wrong results in {}" .format(HALNAMES[defhtype], MBNAMES[defmtype[0]], lcl)) - if None != defmtype and mbtOrderSize(defmtype[0]) == 8 and defhtype in [HAL_U32, HAL_S32]: - pwarn("Haltype destination '{}' is smaller than Modbus source type {} in {}" - .format(HALNAMES[defhtype], MBNAMES[defmtype[0]], lcl)) - if (cflags & MBCCB_CMDF_RESEND) and interval == 0xffffffff: perr("Interval 'once' and 'resend' are mutually exclusive in {}".format(lcl)) continue @@ -1278,7 +1279,7 @@ def handleCommands(commands): pwarn("Attribute 'modbustype' ignored for bit functions in {}".format(lpl)) if 'haltype' in pin.attrib: pwarn("Attribute 'haltype' ignored for bit functions in {}".format(lpl)) - pinlist.append({'pin': pintag, 'mtype': 0, 'htype': HAL_BIT, 'flags': 0, 'regofs': regofs}) + pinlist.append({'pin': pintag, 'mtype': 0, 'htype': HAL_BOOL, 'flags': 0, 'regofs': regofs}) pinlistall.append(pintag) regofs += 1 continue @@ -1301,25 +1302,22 @@ def handleCommands(commands): assert pmtype != None # Must have hal and modbus types assert phtype != None # W_REGISTER(S), R_REGISTERS and R_INPUTREGS can have special - if HAL_BIT == phtype and MBT_U != mbtType(pmtype): - perr("Haltype HAL_BIT with register function must use unsigned modbustype in {}".format(lpl)) + if HAL_BOOL == phtype and MBT_U != mbtType(pmtype): + perr("Haltype HAL_BOOL with register function must use unsigned modbustype in {}".format(lpl)) err = True break # scale and clamp flags cf, pf = parseOptFlags(device, pin.attrib, 0, pflags, lpl) - if (pf & MBCCB_PINF_SCALE) and phtype in [HAL_U32, HAL_U64]: + if (pf & MBCCB_PINF_SCALE) and phtype in [HAL_UINT]: pwarn("Unsigned hal types cannot be scaled, disabling in {}".format(lpl)) pf &= ~MBCCB_PINF_SCALE msz = mbtOrderSize(pmtype[0]) - hsz = 4 if phtype in [HAL_U32, HAL_S32] else 8 + hsz = 8 if ((0 == (pf & MBCCB_PINF_SCALE)) and msz >= hsz and - ((MBT_S == mbtType(pmtype[0]) and phtype in [HAL_U32, HAL_U64]) - or (MBT_U == mbtType(pmtype[0]) and phtype in [HAL_S32, HAL_S64]))): + ((MBT_S == mbtType(pmtype[0]) and phtype in [HAL_UINT]) + or (MBT_U == mbtType(pmtype[0]) and phtype in [HAL_SINT]))): pwarn("Signedness mismatch between haltype={} and modbustype={} may give wrong results in {}" .format(HALNAMES[phtype], MBNAMES[pmtype[0]], lpl)) - if (mbtOrderSize(pmtype[0])) == 8 and phtype in [HAL_U32, HAL_S32]: - pwarn("Haltype destination '{}' is smaller than Modbus source type {} in {}" - .format(HALNAMES[phtype], MBNAMES[pmtype[0]], lpl)) if ((mbtOrderSize(pmtype[0]) == 4 and 0 != ((address + regofs) & 1)) or (mbtOrderSize(pmtype[0]) == 8 and 0 != ((address + regofs) & 3))): @@ -1368,7 +1366,7 @@ def handleCommands(commands): err = True break if function in BITFUNCTIONS: - pinlist.append({'pin': pintag, 'mtype': 0, 'htype': HAL_BIT, 'flags': 0, 'regofs': regofs}) + pinlist.append({'pin': pintag, 'mtype': 0, 'htype': HAL_BOOL, 'flags': 0, 'regofs': regofs}) regofs += 1 else: pinlist.append({'pin': pintag, 'mtype': defmtype[0], 'htype': defhtype, 'flags': pflags, 'regofs': regofs}) @@ -1404,8 +1402,8 @@ def handleCommands(commands): io = "in " if function in WRITEFUNCTIONS else "out" for p in range(len(pinlist)): pin = pinlist[p] - if HAL_BIT == pin['htype']: - mbn = 'HAL_BIT<=>BIT' + if HAL_BOOL == pin['htype']: + mbn = 'HAL_BOOL<=>BIT' else: mbn = '{}<=>{}'.format(HALNAMES[pin['htype']], MBNAMES[pin['mtype']]) print(" pin {:2} ({}): {:24} {} flags={} addr=0x{:04x}".format(p+1, io, pin['pin'], @@ -1414,11 +1412,11 @@ def handleCommands(commands): if function in WRITEFUNCTIONS: pt = HALNAMES[pin['htype']] else: - pt = {MBT_U: "HAL_U64", MBT_S: "HAL_S64", MBT_F: "HAL_FLOAT"}[mbtType(pin['mtype'])] + pt = {MBT_U: "HAL_UINT", MBT_S: "HAL_SINT", MBT_F: "HAL_REAL"}[mbtType(pin['mtype'])] print(" (in ): {:24} {}".format(pin['pin']+".offset", pt)) - print(" (in ): {:24} HAL_FLOAT".format(pin['pin']+".scale")) + print(" (in ): {:24} HAL_REAL".format(pin['pin']+".scale")) if function not in WRITEFUNCTIONS: - print(" (out): {:24} HAL_FLOAT".format(pin['pin']+".scaled")) + print(" (out): {:24} HAL_REAL".format(pin['pin']+".scaled")) # end for cmd in commands: return cmdlist @@ -1685,7 +1683,7 @@ def main(): typeptr, i['interval'], i['timeout'], pinptr)) # typedef struct { - # rtapi_u8 sig[8]; // Signature and version {'M','e','s','a','M','B','0','1'} + # rtapi_u8 sig[8]; // Signature and version {'M','e','s','a','M','B','0','2'} # rtapi_u32 baudrate; # rtapi_u16 format; // Parity and stopbits # rtapi_u16 txdelay; // Tx t3.5 @@ -1704,7 +1702,7 @@ def main(): flg |= MBCCB_FORMAT_DUPLEX if configparams['duplex'] else 0 flg |= MBCCB_FORMAT_SUSPEND if configparams['suspend'] else 0 header = (struct.pack(">8sIHHHHHHIIIIIIIIII", - b'MesaMB01', + b'MesaMB02', configparams['baudrate'], par[configparams['parity']] | flg, configparams['txdelay'], diff --git a/src/hal/drivers/mesa-hostmot2/modbus/analogue.mod b/src/hal/drivers/mesa-hostmot2/modbus/analogue.mod index f2e3b899c98..73cfef7d94f 100644 --- a/src/hal/drivers/mesa-hostmot2/modbus/analogue.mod +++ b/src/hal/drivers/mesa-hostmot2/modbus/analogue.mod @@ -6,7 +6,7 @@ The format of the channel descriptors is: {TYPE, FUNC, ADDR, COUNT, pin_name} -TYPE is one of HAL_BIT, HAL_FLOAT, HAL_S32, HAL_U32, ENCODER +TYPE is one of HAL_BOOL, HAL_REAL, HAL_SINT, HAL_UINT, ENCODER FUNC = 1, 2, 3, 4, 5, 6, 15, 16 - Modbus commands COUNT = number of coils/registers to read */ @@ -15,7 +15,7 @@ COUNT = number of coils/registers to read static const hm2_modbus_chan_descriptor_t channels[] = { /* {TYPE, FUNC, ADDR, COUNT, pin_name} */ - {HAL_FLOAT, 3, 0x0000, 1, "volts"}, + {HAL_REAL, 3, 0x0000, 1, "volts"}, }; /* Optionally #define DEBUG to aid with troubleshooting. diff --git a/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.c.tmpl b/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.c.tmpl index 05b2b3dad34..5e825090fe0 100644 --- a/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.c.tmpl +++ b/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.c.tmpl @@ -259,7 +259,7 @@ int rtapi_app_main(void){ p = 0; // HAL pin index, not aligned to channel index for (c = 0; c < inst->num_chans; c++){ hm2_modbus_channel_t *ch = &(inst->chans[c]); - hal_pin_dir_t dir; + hal_pdir_t dir; rtapi_print_msg(RTAPI_MSG_INFO, "ch %i is at %p\n", c, ch); ch->type = channels[c].type; ch->func = channels[c].func; @@ -324,7 +324,7 @@ int rtapi_app_main(void){ case 4: // read input registers for (j = 0; j < ch->count; j++){ switch (ch->type){ - case HAL_U32: + case HAL_UINT: if (ch->count > 1) { retval = hal_pin_new_ui32(comp_id, dir, &(inst->hal->pins[p].u), @@ -338,7 +338,7 @@ int rtapi_app_main(void){ } p++; break; - case HAL_S32: + case HAL_SINT: if (ch->count > 1) { retval = hal_pin_new_si32(comp_id, dir, &(inst->hal->pins[p].s), @@ -369,7 +369,7 @@ int rtapi_app_main(void){ inst->hal->buff[p] = 0; p++; break; - case HAL_FLOAT: + case HAL_REAL: if (ch->count > 1) { retval = hal_pin_new_real(comp_id, dir, &(inst->hal->pins[p].r), @@ -681,13 +681,13 @@ static int build_data_frame(hm2_modbus_inst_t *inst){ case 6: //Write single register r += ch_append16(ch, ch->addr); switch (ch->type){ - case HAL_U32: + case HAL_UINT: r += ch_append16(ch, (rtapi_u16)hal_get_ui32(hal->pins[p].u)); break; - case HAL_S32: + case HAL_SINT: r += ch_append16(ch, (rtapi_s16)hal_get_si32(hal->pins[p].s)); break; - case HAL_FLOAT: + case HAL_REAL: rtapi_print_msg(RTAPI_MSG_INFO, "671 %f %f %f \n", hal_get_real(hal->pins[p].r), hal_get_real(hal->pin2[p].r), hal_get_real(hal->scale[p])); if (hal_get_real(hal->scale[p]) <= -EPSILON || hal_get_real(hal->scale[p]) >= +EPSILON){ r+= ch_append16(ch, (rtapi_u16)((hal_get_real(hal->pins[p].r) - hal_get_real(hal->pin2[p].r)) / hal_get_real(hal->scale[p]))) ; @@ -716,13 +716,13 @@ static int build_data_frame(hm2_modbus_inst_t *inst){ r += ch_append8(ch, ch->count * 2); for (i = 0; i < ch->count; i++){ switch (ch->type){ - case HAL_U32: + case HAL_UINT: r += ch_append16(ch, (rtapi_u16)hal_get_ui32(hal->pins[p].u)); break; - case HAL_S32: + case HAL_SINT: r += ch_append16(ch, (rtapi_s16)hal_get_si32(hal->pins[p].s)); break; - case HAL_FLOAT: + case HAL_REAL: if (hal_get_real(hal->scale[p]) <= -EPSILON || hal_get_real(hal->scale[p]) >= +EPSILON){ r+= ch_append16(ch, (rtapi_u16)((hal_get_real(hal->pins[p].r) - hal_get_real(hal->pin2[p].r)) / hal_get_real(hal->scale[p]))) ; } else { @@ -793,12 +793,12 @@ static int parse_data_frame(hm2_modbus_inst_t *inst){ w = 3; for (i = 0; i < bytes[2] / 2; i++){ switch (ch->type){ - case HAL_U32: + case HAL_UINT: hal_set_ui32(hal->pins[p].u, 256 * bytes[w] + bytes[w + 1]); w += 2; p++; break; - case HAL_S32: // wrap the result into the (s32) offset too + case HAL_SINT: // wrap the result into the (s32) offset too tmp = hal_get_si32(hal->pins[p].s); hal_set_si32(hal->pins[p].s, bytes[w] * 256 + bytes[w + 1]); w += 2; @@ -809,7 +809,7 @@ static int parse_data_frame(hm2_modbus_inst_t *inst){ hal_set_real(hal->pin2[p].r, hal->buff[p] * hal_get_real(hal->scale[p])); p++; break; - case HAL_FLOAT: + case HAL_REAL: hal_set_real(hal->pins[p].r, (256 * bytes[w] + bytes[w + 1]) * hal_get_real(hal->scale[p]) + hal_get_real(hal->pin2[p].r)); w += 2; diff --git a/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.mod.sample b/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.mod.sample index 5530b6e2b79..bb8ee75120a 100644 --- a/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.mod.sample +++ b/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.mod.sample @@ -3,7 +3,7 @@ The format of the channel descriptors is: {TYPE, FUNC, ADDR, COUNT, pin_name} -TYPE is one of HAL_BIT, HAL_FLOAT, HAL_S32, HAL_U32 +TYPE is one of HAL_BOOL, HAL_REAL, HAL_SINT, HAL_UINT FUNC = 1, 2, 3, 4, 5, 6, 15, 16 - Modbus commands COUNT = number of coils/registers to read */ @@ -13,21 +13,21 @@ COUNT = number of coils/registers to read static const hm2_modbus_chan_descriptor_t channels[] = { /* {TYPE, FUNC, ADDR, COUNT, pin_name} */ // Create 8 HAL bit pins coil-00 .. -07 supplying the values of coils at 0x0000 - {HAL_BIT, 1, 0x0000, 8, "coil"}, + {HAL_BOOL, 1, 0x0000, 8, "coil"}, // Create 8 HAL bit pins input-00 .. -07 supplying the values of inputs at 0x0000 - {HAL_BIT, 2, 0x0000, 8, "input"}, + {HAL_BOOL, 2, 0x0000, 8, "input"}, // Create a HAL pin to set the coil at address 0x0010 - {HAL_BIT, 5, 0x0010, 1, "coil-0"}, + {HAL_BOOL, 5, 0x0010, 1, "coil-0"}, // Create 8 HAL pins to set the coils at 0x0020 - {HAL_BIT, 15, 0x0020, 8, "more_coils"}, + {HAL_BOOL, 15, 0x0020, 8, "more_coils"}, // Create a scaled floating point pin calculated from input register 0x0100 - {HAL_FLOAT, 4, 0x0100, 1, "float"}, + {HAL_REAL, 4, 0x0100, 1, "float"}, // Create 4 unsigned integer HAL pins from the holding registers at 0x0200-0x203 - {HAL_S32, 3, 0x0003, 4, "holding"}, + {HAL_SINT, 3, 0x0003, 4, "holding"}, // Create a single signed int HAL pin to control the register at 0x0300 - {HAL_S32, 6, 0x0300, 1, "relay-3"}, + {HAL_SINT, 6, 0x0300, 1, "relay-3"}, // Create 7 scaled FP HAL pins to control holfing registers at 0x400-0x406 - {HAL_FLOAT, 16, 0x0300, 1, "more_floats"}, + {HAL_REAL, 16, 0x0300, 1, "more_floats"}, }; // vim: syn=c diff --git a/src/hal/drivers/mesa-hostmot2/modbus/relayboard.mod b/src/hal/drivers/mesa-hostmot2/modbus/relayboard.mod index 83d913dce94..7b4259ef1a9 100644 --- a/src/hal/drivers/mesa-hostmot2/modbus/relayboard.mod +++ b/src/hal/drivers/mesa-hostmot2/modbus/relayboard.mod @@ -5,7 +5,7 @@ The format of the channel descriptors is: {TYPE, FUNC, ADDR, COUNT, pin_name} -TYPE is one of HAL_BIT, HAL_FLOAT, HAL_S32, HAL_U32 +TYPE is one of HAL_BOOL, HAL_REAL, HAL_SINT, HAL_UINT FUNC = 1, 2, 3, 4, 5, 6, 15, 16 - Modbus commands COUNT = number of coils/registers to read */ @@ -14,12 +14,12 @@ COUNT = number of coils/registers to read static const hm2_modbus_chan_descriptor_t channels[] = { /* {TYPE, FUNC, ADDR, COUNT, pin_name} */ - {HAL_BIT, 1, 0x0000, 8, "state"}, - {HAL_BIT, 2, 0x0000, 8, "input"}, - {HAL_BIT, 5, 0x0000, 1, "relay-0"}, - {HAL_BIT, 5, 0x0001, 1, "relay-1"}, - {HAL_BIT, 5, 0x0002, 1, "relay-2"}, - {HAL_BIT, 5, 0x0003, 1, "relay-3"}, + {HAL_BOOL, 1, 0x0000, 8, "state"}, + {HAL_BOOL, 2, 0x0000, 8, "input"}, + {HAL_BOOL, 5, 0x0000, 1, "relay-0"}, + {HAL_BOOL, 5, 0x0001, 1, "relay-1"}, + {HAL_BOOL, 5, 0x0002, 1, "relay-2"}, + {HAL_BOOL, 5, 0x0003, 1, "relay-3"}, }; diff --git a/src/hal/drivers/mesa_uart.comp b/src/hal/drivers/mesa_uart.comp index b62d5b84d54..816d2f99d45 100644 --- a/src/hal/drivers/mesa_uart.comp +++ b/src/hal/drivers/mesa_uart.comp @@ -41,10 +41,10 @@ license "GPL"; include ; -pin in ui32 tx-data-##[16] "Data to be transmitted"; -pin out ui32 rx-data-##[16] "Data received"; -pin in si32 tx-bytes "Number of bytes to transmit"; -pin out si32 rx-bytes "Number of Bytes received"; +pin in uint tx-data-##[16] "Data to be transmitted"; +pin out uint rx-data-##[16] "Data received"; +pin in sint tx-bytes "Number of bytes to transmit"; +pin out sint rx-bytes "Number of Bytes received"; variable char *name; // UART name diff --git a/src/hal/drivers/opto_ac5.c b/src/hal/drivers/opto_ac5.c index cb90507bf1b..4b1fd72b6a8 100644 --- a/src/hal/drivers/opto_ac5.c +++ b/src/hal/drivers/opto_ac5.c @@ -263,7 +263,7 @@ static int Device_ExportDigitalInPinsParametersFunctions(board_data_t *this, int // Export functions. if(!halError){ - halError = hal_export_functf(Device_DigitalInRead, this, 0, 0, comp_id, "opto-ac5.%d.digital-read", boardId); + halError = hal_export_functf(Device_DigitalInRead, this, 0, comp_id, "opto-ac5.%d.digital-read", boardId); } if(halError){ @@ -323,7 +323,7 @@ static int Device_ExportDigitalOutPinsParametersFunctions(board_data_t *this, in } // Export functions. if(!halError){ - halError = hal_export_functf(Device_DigitalOutWrite, this, 0, 0, comp_id, "opto-ac5.%d.digital-write", boardId); + halError = hal_export_functf(Device_DigitalOutWrite, this, 0, comp_id, "opto-ac5.%d.digital-write", boardId); } if(halError){ diff --git a/src/hal/drivers/pci_8255.c b/src/hal/drivers/pci_8255.c index 682a9e09cf9..55ad9c9a947 100644 --- a/src/hal/drivers/pci_8255.c +++ b/src/hal/drivers/pci_8255.c @@ -74,7 +74,7 @@ static inline int pci_8255_inb(rtapi_u32 base, int offset) { static int export(char *prefix, struct port *inst, int ioaddr, int dir) { int r = 0; int i; - hal_pin_dir_t direction; + hal_pdir_t direction; int sz = sizeof(struct port); memset(inst, 0, sz); if(0 != (r = hal_param_new_fake(comp_id, (hal_refs_u *)&inst->ioaddr))) @@ -132,9 +132,9 @@ static int export(char *prefix, struct port *inst, int ioaddr, int dir) { r = hal_param_new_ui32(comp_id, HAL_RO, &(inst->dir_), dir, "%s.dir", prefix); if(r != 0) return r; - r = hal_export_functf((void(*)(void *inst, long))read, inst, 0, 0, comp_id, "%s.read", prefix); + r = hal_export_functf((void(*)(void *inst, long))read, inst, 0, comp_id, "%s.read", prefix); if(r != 0) return r; - r = hal_export_functf((void(*)(void *inst, long))write, inst, 0, 0, comp_id, "%s.write", prefix); + r = hal_export_functf((void(*)(void *inst, long))write, inst, 0, comp_id, "%s.write", prefix); if(r != 0) return r; rtapi_print_msg(RTAPI_MSG_DBG, "registering %s ... %x %x\n", prefix, @@ -208,11 +208,11 @@ int rtapi_app_main(void) { hal_pin_new_bool(comp_id, HAL_IN, &(inst[i].relay), 0, "pci8255.%d.relay", i); hal_param_new_bool(comp_id, HAL_RW, &(inst[i].relay_invert), 0, "pci8255.%d.relay-invert", i); - r = hal_export_functf((void(*)(void *inst, long))write_relay, &inst[i], 0, 0, comp_id, "pci8255.%d.write-relay", i); + r = hal_export_functf((void(*)(void *inst, long))write_relay, &inst[i], 0, comp_id, "pci8255.%d.write-relay", i); if(r != 0) return r; } - r = hal_export_funct("pci8255.read-all", (void(*)(void *inst, long))read_all, inst, 0, 0, comp_id); - r = hal_export_funct("pci8255.write-all", (void(*)(void *inst, long))write_all, inst, 0, 0, comp_id); + r = hal_export_funct("pci8255.read-all", (void(*)(void *inst, long))read_all, inst, 0, comp_id); + r = hal_export_funct("pci8255.write-all", (void(*)(void *inst, long))write_all, inst, 0, comp_id); out_error: if(r) { extra_cleanup(); diff --git a/src/hal/drivers/pcl720.comp b/src/hal/drivers/pcl720.comp index 1c455490200..c225ed259f6 100644 --- a/src/hal/drivers/pcl720.comp +++ b/src/hal/drivers/pcl720.comp @@ -7,23 +7,23 @@ not support the the counters/timers."""; pin in bool pin-##-out[32] "Output pins"; pin out bool pin-##-in[32] "Input pins"; pin out bool pin-##-in-not[32] "Inverted version of each input pin"; -param rw ui32 reset-time = 5000 """The time in nanoseconds after the write function +param rw uint reset-time = 5000 """The time in nanoseconds after the write function has run to reset the pins for which the "reset" parameter is set."""; param rw bool pin-##-reset[32] """specifies if the pin should be reset by the "reset" function"""; param rw bool pin-##-out-invert[32] "Set to true to invert the sense of the output pin"; -pin out ui32 wait_clocks; +pin out uint wait_clocks; function read "Reads each of the digital inputs and updates the HAL pins"; function write "Writes the values of the output HAL pins to the digital IO"; function reset """Waits for the length of time specified by the -\\fBreset-time\\fP parameter and resets any pins for which the \\fBreset\\fP +*reset-time* parameter and resets any pins for which the *reset* parameter has been set. This can be used to allow step generators to make a step every thread rather than every other thread. This function must be added to the thread after the "write" function. Do not use this function if you do not wish to reset any pins. - the stepgen \\fBstep-space\\fP parameter should be set to 0 to make use of this + the stepgen *step-space* parameter should be set to 0 to make use of this function."""; variable unsigned base_addr; diff --git a/src/hal/drivers/pluto_servo.comp b/src/hal/drivers/pluto_servo.comp index 000d5580776..586b0557282 100644 --- a/src/hal/drivers/pluto_servo.comp +++ b/src/hal/drivers/pluto_servo.comp @@ -47,18 +47,18 @@ described in the HAL manual. The digital input pins conform to the `canonical digital input' interface described in the HAL manual. """; -pin out si32 encoder.#.count[4]; +pin out sint encoder.#.count[4]; pin out real encoder.#.position[4]; pin out real encoder.#.velocity[4]; pin in bool encoder.#.reset[4]; -pin io bool encoder.#.index-enable[4] """encoder.\\fIM\\fR corresponds to the -pins labeled QA\\fIM\\fR, QB\\fIM\\fR, and QZ\\fIM\\fR on the pinout diagram"""; +pin io bool encoder.#.index-enable[4] """encoder.__M__ corresponds to the +pins labeled QA__M__, QB__M__, and QZ__M__ on the pinout diagram"""; param rw real encoder.#.scale[4] =1; param rw bool encoder.z-polarity "Set to TRUE if the index pulse is active low, FALSE if it is active high. Affects all encoders."; pin in real pwm.#.value[4]; -pin in bool pwm.#.enable[4] "pwm.\\fIM\\fR corresponds to the pins labeled UP\\fIM\\fR and DN\\fIM\\fR on the pinout diagram"; +pin in bool pwm.#.enable[4] "pwm.__M__ corresponds to the pins labeled UP__M__ and DN__M__ on the pinout diagram"; param rw real pwm.#.offset[4]; param rw real pwm.#.scale[4]=1; param rw real pwm.#.max-dc[4]=1; @@ -70,79 +70,48 @@ param rw bool pwm.is-pdm "Set to TRUE to use PDM (also called interleaved PWM) m pin in bool dout.##[20] -"""dout.\\fI0M\\fR corresponds to the pin labeled -OUT\\fIM\\fR on the pinout diagram. Other pins are shared with the PWM +"""dout.__0M__ corresponds to the pin labeled +OUT__M__ on the pinout diagram. Other pins are shared with the PWM function, as follows: -.RS 6 -.ta T 10 6 -.PP -\\fBPin\tShared\\fR -.PP -\\fBLabel\twith\\fR -.PP -dout.10\tUP0 -.PP -dout.10\tUP0 -.PP -dout.12\tUP1 -.PP -dout.14\tUP2 -.PP -dout.18\tUP3 -.PP -dout.11\tDOWN0 -.PP -dout.13\tDOWN1 -.PP -dout.15\tDOWN2 -.PP -dout.19\tDOWN3 -.PP -.RE -.DT"""; +|=== +|Pin Label | Shared width +|dout.10 | UP0 +|dout.10 | UP0 +|dout.12 | UP1 +|dout.14 | UP2 +|dout.18 | UP3 +|dout.11 | DOWN0 +|dout.13 | DOWN1 +|dout.15 | DOWN2 +|dout.19 | DOWN3 +|=== +"""; param rw bool dout.##-invert[20] -"If TRUE, the output on the corresponding \\fBdout.\\fIMM\\fR is inverted."; +"If TRUE, the output on the corresponding \\fBdout.__MM__ is inverted."; pin out bool din.##[20]; pin out bool din.##_not[20] -"""For M=0 through 7, din.\\fI0M\\fR corresponds to the pin labeled -IN\\fIM\\fR on the pinout diagram. Other pins are shared with the encoder +"""For M=0 through 7, din.__0M__ corresponds to the pin labeled +IN__M__ on the pinout diagram. Other pins are shared with the encoder function, as follows: -.RS 6 -.ta T 10 6 -.PP -\\fBPin\tShared\\fR -.PP -\\fBLabel\twith\\fR -.PP -din.8\tQZ0 -.PP -din.9\tQZ1 -.PP -din.10\tQZ2 -.PP -din.11\tQZ3 -.PP -din.12\tQB0 -.PP -din.13\tQB1 -.PP -din.14\tQB2 -.PP -din.15\tQB3 -.PP -din.16\tQA0 -.PP -din.17\tQA1 -.PP -din.18\tQA2 -.PP -din.19\tQA3 -.PP -.RE -.DT"""; - -param rw ui32 communication_error """Incremented each time +|=== +|Pin Label | Shared with +|din.8 | QZ0 +|din.9 | QZ1 +|din.10 | QZ2 +|din.11 | QZ3 +|din.12 | QB0 +|din.13 | QB1 +|din.14 | QB2 +|din.15 | QB3 +|din.16 | QA0 +|din.17 | QA1 +|din.18 | QA2 +|din.19 | QA3 +|=== +"""; + +param rw uint communication_error """Incremented each time pluto-servo.read detects an error code in the EPP status register. While this register is nonzero, new values are not being written to the Pluto-P board, and the status of digital outputs and the PWM duty cycle of the PWM @@ -150,8 +119,8 @@ outputs will remain unchanged. If the watchdog is enabled, it will activate soon after the communication error is detected. To continue after a communication error, set this parameter back to zero."""; -param rw si32 debug_0; -param rw si32 debug_1 """These parameters can display values which are useful to developers or for debugging the driver and firmware. They are not useful for integrators or users."""; +param rw sint debug_0; +param rw sint debug_1 """These parameters can display values which are useful to developers or for debugging the driver and firmware. They are not useful for integrators or users."""; option singleton; option extra_setup; @@ -162,7 +131,7 @@ option data internal; function read "Read all the inputs from the pluto-servo board"; function write "Write all the outputs on the pluto-servo board"; -see_also """The \\fIpluto_servo\\fR section in the HAL User Manual, which shows the location of each physical pin on the pluto board."""; +see_also """The __pluto_servo__ section in the HAL User Manual, which shows the location of each physical pin on the pluto board."""; modparam dummy ioaddr = 0x378 "The base address of the parallel port."; modparam dummy ioaddr_hi = 0 @@ -179,7 +148,7 @@ functions. However, this may not work on all EPP parallel ports."""; modparam dummy watchdog = 1 """Set to zero to disable the "hardware watchdog". "Watchdog" will tristate all outputs approximately 6ms after the last execution of -\\fBpluto-servo.write\\fR, which adds some protection in the case of LinuxCNC +**pluto-servo.write**, which adds some protection in the case of LinuxCNC crashes."""; modparam int test_encoder = 0 diff --git a/src/hal/drivers/pluto_step.comp b/src/hal/drivers/pluto_step.comp index eba52022e01..423b976b948 100644 --- a/src/hal/drivers/pluto_step.comp +++ b/src/hal/drivers/pluto_step.comp @@ -16,50 +16,37 @@ component pluto_step """Hardware driver and firmware for the Pluto-P parallel-port FPGA, for use with stepper machines. -.B loadrt pluto_step ioaddr=\\fIaddr\\fB ioaddr_hi=\\fIaddr\\fB epp_wide=\\fI[0|1]\\fB +loadrt *pluto_step* ioaddr=__Iaddr__ ioaddr_hi=__addr__ epp_wide=__[0|1]__ -.RS 4 -.TP -\\fBioaddr\\fR [default: 0x378] +ioaddr [default: 0x378]:: The base address of the parallel port. -.TP -\\fBioaddr_hi\\fR [default: 0] +ioaddr_hi [default: 0]:: The secondary address of the parallel port, used to set EPP mode. 0 means to use ioaddr + 0x400. -1 means there is no secondary address. -.TP -\\fBepp_wide\\fR [default: 1] +epp_wide [default: 1]:: Set to zero to disable "wide EPP mode". "Wide" mode allows 16- and 32-bit EPP transfers, which can reduce the time spent in the read and write functions. However, this mode may not work on all EPP parallel ports. -.TP -\\fBwatchdog\\fR [default: 1] +watchdog [default: 1]:: Set to zero to disable the "hardware watchdog". "Watchdog" will tristate all -outputs approximately 6ms after the last execution of -\\fBpluto-step.write\\fR, which adds some protection in the case of LinuxCNC -crashes. +outputs approximately 6ms after the last execution of **pluto-step.write**, +which adds some protection in the case of LinuxCNC crashes. -.TP -\\fBspeedrange\\fR [default: 0] +speedrange [default: 0]:: Selects one of four speed ranges: -.RS -.RS 4 -.TQ -0: Top speed 312.5kHz; minimum speed 610Hz -.TQ -1: Top speed 156.25kHz; minimum speed 305Hz -.TQ -2: Top speed 78.125kHz; minimum speed 153Hz -.TQ -3: Top speed 39.06kHz; minimum speed 76Hz -.RE + +* 0: Top speed 312.5kHz; minimum speed 610Hz +* 1: Top speed 156.25kHz; minimum speed 305Hz +* 2: Top speed 78.125kHz; minimum speed 153Hz +* 3: Top speed 39.06kHz; minimum speed 76Hz + Choosing the smallest maximum speed that is above the maximum for any one axis may give improved step regularity at low step speeds. -.RE -.RE"""; +"""; description """ Pluto_step is a LinuxCNC software driver and associated firmware that allow the Pluto-P board to be used to control a stepper-based CNC machine. @@ -67,15 +54,15 @@ Pluto_step is a LinuxCNC software driver and associated firmware that allow the The driver has 4 step+direction channels, 14 dedicated digital outputs, and 16 dedicated digital inputs. -.SS Step generators +=== Step generators The step generator takes a position input and output. The step waveform includes step length/space and direction hold/setup time. Step length and direction setup/hold time is enforced in the FPGA. Step space is enforced by a velocity cap in the driver. -\\fI(all the following numbers are subject to change)\\fR -In \\fIspeedrange=0\\fR, the maximum step rate is 312.5kHz. For position + __(all the following numbers are subject to change)__ +In __speedrange=0__, the maximum step rate is 312.5kHz. For position feedback to be accurate, the maximum step rate is 512 pulses per servo cycle (so a 1kHz servo cycle does not impose any additional limitation). The maximum step rate may be lowered by the step length and space parameters, which are @@ -84,7 +71,7 @@ rounded up to the nearest multiple of 1600ns. In successive speedranges the maximum step rate is divided in half, as is the maximum steps per servo cycle, and the minimum nonzero step rate. -.SS Digital I/O +=== Digital I/O The digital output pins conform to the `canonical digital output' interface described in the HAL manual. @@ -94,29 +81,29 @@ described in the HAL manual. pin in real stepgen.#.position-cmd[4]; pin out real stepgen.#.velocity-fb[4]; pin out real stepgen.#.position-fb[4]; -pin out si32 stepgen.#.counts[4]; +pin out sint stepgen.#.counts[4]; pin in bool stepgen.#.enable[4]; pin in bool stepgen.#.reset[4] "When TRUE, reset position-fb to 0"; param rw real stepgen.#.scale[4] = 1.0; param rw real stepgen.#.maxvel[4] = 0; param rw bool stepgen.step_polarity; -param rw ui32 stepgen.steplen "Step length in ns."; -param rw ui32 stepgen.stepspace "Step space in ns"; -param rw ui32 stepgen.dirtime "Dir hold/setup in ns. Refer to the pdf documentation for a diagram of what these timings mean."; +param rw uint stepgen.steplen "Step length in ns."; +param rw uint stepgen.stepspace "Step space in ns"; +param rw uint stepgen.dirtime "Dir hold/setup in ns. Refer to the pdf documentation for a diagram of what these timings mean."; pin in bool dout.##[14] -"""dout.\\fIMM\\fR corresponds to the pin labeled -OUT\\fIM\\fR on the pinout diagram."""; +"""dout.__MM__ corresponds to the pin labeled +OUT__M__ on the pinout diagram."""; param rw bool dout.##-invert[14] -"If TRUE, the output on the corresponding \\fBdout.\\fIMM\\fR is inverted."; +"If TRUE, the output on the corresponding \\fBdout.__MM__ is inverted."; pin out bool din.##[16]; pin out bool din.##_not[16] -"""din.\\fIMM\\fR corresponds to the pin labeled -IN\\fIM\\fR on the pinout diagram."""; +"""din.__MM__ corresponds to the pin labeled +IN__M__ on the pinout diagram."""; -param rw ui32 communication_error """Incremented each time +param rw uint communication_error """Incremented each time pluto-step.read detects an error code in the EPP status register. While this register is nonzero, new values are not being written to the Pluto-P board, and the status of digital outputs and the PWM duty cycle of the PWM @@ -124,8 +111,8 @@ outputs will remain unchanged. If the hardware watchdog is enabled, it will activate shortly after the communication error is detected by LinuxCNC. To continue after a communication error, set this parameter back to zero."""; -param rw si32 debug_0; -param rw si32 debug_1; +param rw sint debug_0; +param rw sint debug_1; param rw real debug_2=.5; param rw real debug_3=2.0 """Registers that hold debugging information of interest to developers"""; @@ -139,7 +126,7 @@ option data internal; function read "Read all the inputs from the pluto-step board"; function write "Write all the outputs on the pluto-step board"; -see_also """The \\fIpluto_step\\fR section in the HAL User Manual, which shows the location of each physical pin on the pluto board."""; +see_also """The __pluto_step__ section in the HAL User Manual, which shows the location of each physical pin on the pluto board."""; license "GPL"; include ; @@ -172,9 +159,9 @@ typedef struct { FUNCTION(write) { int r = 0; int i; - int stepspace_ticks = stepgen_stepspace/PLUTO_SPEED_NS; - int steplen_ticks = stepgen_steplen/PLUTO_SPEED_NS; - int dirtime_ticks = stepgen_dirtime/PLUTO_SPEED_NS; + rtapi_sint stepspace_ticks = stepgen_stepspace/PLUTO_SPEED_NS; + rtapi_sint steplen_ticks = stepgen_steplen/PLUTO_SPEED_NS; + rtapi_sint dirtime_ticks = stepgen_dirtime/PLUTO_SPEED_NS; int rate, maxrate = MAX_STEP_RATE; double fmax; diff --git a/src/hal/drivers/serport.comp b/src/hal/drivers/serport.comp index bee4bab7f82..e6510814b65 100644 --- a/src/hal/drivers/serport.comp +++ b/src/hal/drivers/serport.comp @@ -36,7 +36,7 @@ pin in bool pin_7_out "Also called RTS (request to send); pin 4 on the 25-pin s param rw bool pin_3_out_invert; param rw bool pin_4_out_invert; param rw bool pin_7_out_invert; -param r ui32 ioaddr; +param r uint ioaddr; option count_function; option extra_setup; diff --git a/src/hal/hal.h b/src/hal/hal.h index 02139799cdb..fee5f98ae32 100644 --- a/src/hal/hal.h +++ b/src/hal/hal.h @@ -127,10 +127,44 @@ */ +// +// The HAL_API_VERSION define can be used to determine what features are +// available in the HAL library API. It can be used to make code build on both +// old and new LinuxCNC versions if you need to keep everything in one +// source-tree. +// Currently only two versions are possible: +// a) No define present +// The HAL API is for LinuxCNC up to and including version 2.9. The integer +// pins and params are 32-bit only. +// +// b) HAL_API_VERSION == 1 +// The HAL API if for LinuxCNC 2.10 and later. It supports the getter, +// setter and query API. Any access to the underlying data or HAL's private +// inners is not allowed. HAL pins and params are opaque structures. The +// underlying data size of integers is 64-bit. +// +#define HAL_API_VERSION 1 + +// +// HAL_STATIC_ASSERT wrapper for compile time asserts +// +#if __STDC_VERSION__ >= 202311L || defined(__cplusplus) +#define HAL_STATIC_ASSERT(expr, msg) static_assert((expr), msg) +#else +// _Static_assert: GCC extension, in C standard since C11, deprecated +// in favour of static_assert (like C++) from C23 onwards. +#define HAL_STATIC_ASSERT(expr, msg) _Static_assert((expr), msg) +#endif + +// Some useful defines +#define __HAL_DEPRECATED(msg) __attribute__((deprecated(msg))) +#define __HAL_ALWAYS_INLINE __attribute__((always_inline)) +#define __HAL_PFMT(a,b) __attribute__((format(printf,a,b))) + #include "rtapi.h" RTAPI_BEGIN_DECLS -#if ( !defined RTAPI ) && ( !defined ULAPI ) +#if !defined(RTAPI) && !defined(ULAPI) #error HAL needs RTAPI/ULAPI, check makefile and flags #endif @@ -214,7 +248,7 @@ void hal_lib_exit(void); Call only from within user space or init/cleanup code, not from realtime code. */ -extern int hal_init(const char *name); +int hal_init(const char *name); /** 'hal_exit()' must be called before a HAL component exits, to free resources associated with the component. @@ -233,7 +267,7 @@ extern int hal_init(const char *name); On success, hal_exit() returns 0, on failure it returns a negative error code. */ -extern int hal_exit(int comp_id); +int hal_exit(int comp_id); /** hal_malloc() allocates a block of memory from the main HAL shared memory area. It should be used by all components to @@ -252,13 +286,13 @@ extern int hal_exit(int comp_id); all components completely clears memory and you start fresh. */ -extern void *hal_malloc(long int size); +void *hal_malloc(long int size); /** hal_ready() indicates that this component is ready. This allows halcmd 'loadusr -W hal_example' to wait until the userspace component 'hal_example' is ready before continuing. */ -extern int hal_ready(int comp_id); +int hal_ready(int comp_id); /** hal_set_unready() sets a component state to unready so additional pins can be added. A subsequent call to @@ -266,13 +300,13 @@ extern int hal_ready(int comp_id); again. Kinematics modules created with halcompile use this function to add pins to a parent component. */ -extern int hal_set_unready(int comp_id); +int hal_set_unready(int comp_id); /** hal_unready() indicates that this component is ready. This allows halcmd 'loadusr -W hal_example' to wait until the userspace component 'hal_example' is ready before continuing. */ -extern int hal_unready(int comp_id); +int hal_unready(int comp_id); // hal_strerror() returns a brief textual description string about the error // identified. The argument should be the negative errno value, as returned by @@ -282,12 +316,12 @@ const char *hal_strerror(int err); /** hal_comp_name() returns the name of the given component, or NULL if comp_id is not a loaded component */ -extern char* hal_comp_name(int comp_id); +const char *hal_comp_name(int comp_id); /** hal_get_realtime_type() returns the type of the running real time */ typedef rtapi_realtime_type_t hal_realtime_type_t; -extern hal_realtime_type_t hal_get_realtime_type(void); +hal_realtime_type_t hal_get_realtime_type(void); /** The HAL maintains lists of variables, functions, and so on in a central database, located in shared memory so all components @@ -327,20 +361,20 @@ extern hal_realtime_type_t hal_get_realtime_type(void); typedef enum { HAL_TYPE_UNSPECIFIED = -1, HAL_TYPE_UNINITIALIZED = 0, - HAL_BIT = 1, - HAL_FLOAT = 2, - HAL_S32 = 3, - HAL_U32 = 4, + HAL_BOOL = 1, + HAL_REAL = 2, + HAL_SINT = 3, + HAL_UINT = 4, HAL_PORT = 5, - HAL_S64 = 6, - HAL_U64 = 7, HAL_TYPE_MAX, -} hal_type_t; -#define HAL_BOOL HAL_BIT -#define HAL_REAL HAL_FLOAT -#define HAL_SINT HAL_S64 -#define HAL_UINT HAL_U64 + HAL_S32 __HAL_DEPRECATED("No longer supported. Please migrate to HAL_SINT") = HAL_SINT, + HAL_U32 __HAL_DEPRECATED("No longer supported. Please migrate to HAL_UINT") = HAL_UINT, + HAL_S64 __HAL_DEPRECATED("Please rename to HAL_SINT") = HAL_SINT, + HAL_U64 __HAL_DEPRECATED("Please rename to HAL_UINT") = HAL_UINT, + HAL_FLOAT __HAL_DEPRECATED("Please rename to HAL_REAL") = HAL_REAL, + HAL_BIT __HAL_DEPRECATED("Please rename to HAL_BOOL") = HAL_BOOL, +} hal_type_t; // // hal_pdir_t - Unified HAL pin/param direction type. Specifies the direction @@ -370,11 +404,8 @@ typedef enum { // Map both old direction types to the new combined type // FIXME: These should be retired at some point -typedef hal_pdir_t hal_pin_dir_t; -typedef hal_pdir_t hal_param_dir_t; - -#define __HAL_DEPRECATED(msg) __attribute__((deprecated(msg))) -#define __HAL_ALWAYS_INLINE __attribute__((always_inline)) +typedef hal_pdir_t hal_pin_dir_t __HAL_DEPRECATED("Please use hal_pdir_t"); +typedef hal_pdir_t hal_param_dir_t __HAL_DEPRECATED("Please use hal_pdir_t"); // // bool hal_pdir_is_pin(hal_pdir_t) @@ -396,37 +427,6 @@ static inline __HAL_ALWAYS_INLINE bool hal_pdir_is_neither(hal_pdir_t v) { return (0 != (v & ~(HAL_IO|HAL_RW))) || (0 == (v & (HAL_IO|HAL_RW))); } -// FIXME: These alignment attributes should be removed. -// HAL now allocates on an 8-byte boundary and the rest should be left to the -// compiler. -// ==> Remove when we get rid of old hal_*_t typedefs. <== -typedef rtapi_real real_t; -typedef rtapi_u64 ireal_t __attribute__((aligned(8))) __attribute__((deprecated)); // integral type as wide as real_t / hal_float_t - -typedef volatile bool hal_bit_t __HAL_DEPRECATED("Use getter/setter API"); -typedef volatile rtapi_u32 hal_u32_t __HAL_DEPRECATED("Use getter/setter API"); -typedef volatile rtapi_s32 hal_s32_t __HAL_DEPRECATED("Use getter/setter API"); -typedef volatile rtapi_u64 hal_u64_t __HAL_DEPRECATED("Use getter/setter API"); -typedef volatile rtapi_s64 hal_s64_t __HAL_DEPRECATED("Use getter/setter API"); -typedef volatile rtapi_real hal_float_t __HAL_DEPRECATED("Use getter/setter API"); -typedef volatile int hal_port_t; - -/** HAL "data union" structure - ** This structure may hold any type of hal data -*/ -typedef union { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - hal_bit_t b; - hal_s32_t s; - hal_u32_t u; - hal_float_t f; - hal_port_t p; - hal_s64_t ls; - hal_u64_t lu; -#pragma GCC diagnostic pop -} hal_data_u __HAL_DEPRECATED("Use getter/setter API"); - // Fake forward declarations so we can make opaque pointers struct __hal_stype_bool_t; struct __hal_stype_sint_t; @@ -438,14 +438,14 @@ typedef struct __hal_stype_bool_t *hal_bool_t; typedef struct __hal_stype_sint_t *hal_sint_t; typedef struct __hal_stype_uint_t *hal_uint_t; typedef struct __hal_stype_real_t *hal_real_t; -//typedef struct __hal_stype_port_t *hal_port_t; +typedef struct __hal_stype_port_t *hal_port_t; typedef union { hal_bool_t b; hal_sint_t s; hal_uint_t u; hal_real_t r; - //hal_port_t p; + hal_port_t p; } hal_refs_u; // We rely on little-endian memory layout in the union where the smaller @@ -461,35 +461,29 @@ typedef union { // This is a define so we don't export it to other code. // It is undef'ed after we're done with it. -// FIXME: Get rid of the 32-bit types when we have upgraded everything using -// getter/setter access only so we have guaranteed content. #define __HAL_MAPPED_TYPE union __hal_mapped_type { \ volatile rtapi_bool _b; \ - volatile rtapi_s32 _ss; \ - volatile rtapi_u32 _su; \ volatile rtapi_sint _s; \ volatile rtapi_uint _u; \ volatile rtapi_real _r; \ + volatile rtapi_port _p; \ } -#if 0 -// The port change must be done later -// A 'hal_port_t' is a pin/param reference which content represents +// A 'hal_port_t' is a pin reference which content represents // the integer offset in the HAL shared memory segment to a // hal_port_shm_t structure. -static inline __HAL_ALWAYS_INLINE rtapi_sint hal_get_port(hal_port_t ref) { +static inline __HAL_ALWAYS_INLINE rtapi_port hal_get_port(hal_port_t ref) { __HAL_MAPPED_TYPE; // cppcheck-suppress dangerousTypeCast - return ((union __hal_mapped_type *)ref)->_s; + return ((union __hal_mapped_type *)ref)->_p; } -static inline __HAL_ALWAYS_INLINE rtapi_sint hal_set_port(hal_port_t ref, rtapi_sint val) { +static inline __HAL_ALWAYS_INLINE rtapi_port hal_set_port(hal_port_t ref, rtapi_port val) { __HAL_MAPPED_TYPE; // cppcheck-suppress dangerousTypeCast - ((union __hal_mapped_type *)ref)->_s = val; // Store in the larger type + ((union __hal_mapped_type *)ref)->_p = val; return val; } -#endif // // The hal_{get,set}_si32() and hal_{get,set}_ui32() are only present for // compatibility. They may be removed when all the remaining code has been @@ -511,7 +505,7 @@ static inline __HAL_ALWAYS_INLINE rtapi_s32 hal_get_si32(const hal_sint_t ref) { __HAL_MAPPED_TYPE; // Implicitly Truncated from the larger type // cppcheck-suppress dangerousTypeCast - return ((union __hal_mapped_type *)ref)->_ss; + return (rtapi_s32)((union __hal_mapped_type *)ref)->_s; } static inline __HAL_ALWAYS_INLINE rtapi_s32 hal_set_si32(hal_sint_t ref, rtapi_s32 val) { __HAL_MAPPED_TYPE; @@ -531,7 +525,7 @@ static inline __HAL_ALWAYS_INLINE rtapi_u32 hal_get_ui32(const hal_uint_t ref) { __HAL_MAPPED_TYPE; // Implicitly Truncated from the larger type // cppcheck-suppress dangerousTypeCast - return ((union __hal_mapped_type *)ref)->_su; + return (rtapi_u32)((union __hal_mapped_type *)ref)->_u; } static inline __HAL_ALWAYS_INLINE rtapi_u32 hal_set_ui32(hal_uint_t ref, rtapi_u32 val) { __HAL_MAPPED_TYPE; @@ -586,31 +580,8 @@ static inline __HAL_ALWAYS_INLINE rtapi_bool hal_set_bool(hal_bool_t ref, rtapi_ ((union __hal_mapped_type *)ref)->_u = val; return val; } -#undef __HAL_ALWAYS_INLINE #undef __HAL_MAPPED_TYPE -#define __HAL_PFMT(a,b) __attribute__((format(printf,a,b))) -int hal_pin_new_bool(int compid, hal_pdir_t dir, hal_bool_t *ref, rtapi_bool def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_pin_new_si32(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_s32 def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_pin_new_ui32(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_u32 def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_pin_new_sint(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_sint def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_pin_new_uint(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_uint def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_pin_new_real(int compid, hal_pdir_t dir, hal_real_t *ref, rtapi_real def, const char *fmt, ...) __HAL_PFMT(5,6); -// Note: port has no initial default as it is an 'internal' reference -//int hal_pin_new_port(int compid, hal_pin_dir_t dir, hal_port_t *ref, const char *fmt, ...) __HAL_PFMT(4,5); -// FIXME: This needs to change into hal_port_t argument when we break the API -// It is here so we may add halmodule without too much trouble until then. -int hal_pin_new_port(int compid, hal_pin_dir_t dir, hal_sint_t *ref, const char *fmt, ...) __HAL_PFMT(4,5); - -int hal_param_new_bool(int compid, hal_pdir_t dir, hal_bool_t *ref, rtapi_bool def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_param_new_si32(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_s32 def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_param_new_ui32(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_u32 def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_param_new_sint(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_sint def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_param_new_uint(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_uint def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_param_new_real(int compid, hal_pdir_t dir, hal_real_t *ref, rtapi_real def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_param_new_fake(int compid, hal_refs_u *refs); -#undef __HAL_PFMT - /*********************************************************************** * "LOCKING" FUNCTIONS * ************************************************************************/ @@ -620,7 +591,7 @@ int hal_param_new_fake(int compid, hal_refs_u *refs); HAL_LOCK_* - intermediate locking levels HAL_LOCK_ALL - locks everything */ -extern int hal_set_lock(unsigned char lock_type); +int hal_set_lock(unsigned char lock_type); /** The 'hal_get_lock()' function returns the current locking level locking types defined in hal.h @@ -629,105 +600,51 @@ extern int hal_set_lock(unsigned char lock_type); HAL_LOCK_ALL - locks everything */ -extern unsigned char hal_get_lock(void); +unsigned char hal_get_lock(void); /*********************************************************************** * "PIN" FUNCTIONS * ************************************************************************/ -/** The 'hal_pin_xxx_new()' functions create a new 'pin' object. - Once a pin has been created, it can be linked to a signal object - using hal_link(). A pin contains a pointer, and the component - that owns the pin can dereference the pointer to access whatever - signal is linked to the pin. (If no signal is linked, it points - to a dummy signal.) - There are eight functions, one for each of the data types that - the HAL supports. Pins may only be linked to signals of the same - type. - 'name' is the name of the new pin. It must be no longer than HAL_NAME_LEN. - If there is already a pin with the same name the call will fail. - 'dir' is the pin direction. It indicates whether the pin is - an input or output from the component. - 'data_ptr_addr' is the address of the pointer that the component - will use for the pin. When the pin is linked to a signal, the - pointer at 'data_ptr_addr' will be changed to point to the signal - data location. 'data_ptr_addr' must point to memory allocated by - hal_malloc(). Typically the component allocates space for a data - structure with hal_malloc(), and 'data_ptr_addr' is the address - of a member of that structure. - 'comp_id' is the ID of the component that will 'own' the - variable. Normally it should be the ID of the caller, but in - some cases, a user mode component may be doing setup for a - realtime component, so the ID should be that of the realtime - component that will actually be using the pin. - If successful, the hal_pin_xxx_new() functions return 0. - On failure they return a negative error code. -*/ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -extern int hal_pin_bit_new(const char *name, hal_pin_dir_t dir, - hal_bit_t ** data_ptr_addr, int comp_id) __HAL_DEPRECATED("Use hal_pin_new_bool()"); -extern int hal_pin_float_new(const char *name, hal_pin_dir_t dir, - hal_float_t ** data_ptr_addr, int comp_id) __HAL_DEPRECATED("Use hal_pin_new_real()"); -extern int hal_pin_u32_new(const char *name, hal_pin_dir_t dir, - hal_u32_t ** data_ptr_addr, int comp_id) __HAL_DEPRECATED("Use hal_pin_new_ui32()"); -extern int hal_pin_s32_new(const char *name, hal_pin_dir_t dir, - hal_s32_t ** data_ptr_addr, int comp_id) __HAL_DEPRECATED("Use hal_pin_new_si32()"); -extern int hal_pin_u64_new(const char *name, hal_pin_dir_t dir, - hal_u64_t ** data_ptr_addr, int comp_id) __HAL_DEPRECATED("Use hal_pin_new_uint()"); -extern int hal_pin_s64_new(const char *name, hal_pin_dir_t dir, - hal_s64_t ** data_ptr_addr, int comp_id) __HAL_DEPRECATED("Use hal_pin_new_sint()"); -extern int hal_pin_port_new(const char *name, hal_pin_dir_t dir, - hal_port_t ** data_ptr_addr, int comp_id); - - -/** The hal_pin_XXX_newf family of functions are similar to - hal_pin_XXX_new except that they also do printf-style formatting to compute - the pin name - If successful, the hal_pin_xxx_newf() functions return 0. - On failure they return a negative error code. -*/ -extern int hal_pin_bit_newf(hal_pin_dir_t dir, - hal_bit_t ** data_ptr_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_pin_new_bool()"); -extern int hal_pin_float_newf(hal_pin_dir_t dir, - hal_float_t ** data_ptr_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_pin_new_real()"); -extern int hal_pin_u32_newf(hal_pin_dir_t dir, - hal_u32_t ** data_ptr_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_pin_new_ui32()"); -extern int hal_pin_s32_newf(hal_pin_dir_t dir, - hal_s32_t ** data_ptr_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_pin_new_si32()"); -extern int hal_pin_u64_newf(hal_pin_dir_t dir, - hal_u64_t ** data_ptr_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_pin_new_uint()"); -extern int hal_pin_s64_newf(hal_pin_dir_t dir, - hal_s64_t ** data_ptr_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_pin_new_sint()"); -extern int hal_pin_port_newf(hal_pin_dir_t dir, - hal_port_t** data_ptr_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))); -#pragma GCC diagnostic pop - - -/** 'hal_pin_new()' creates a new 'pin' object. It is a generic - version of the eight functions above. It is provided ONLY for - those special cases where a generic function is needed. It is - STRONGLY recommended that the functions above be used instead, - because they check the type of 'data_ptr_addr' against the pin - type at compile time. Using this function requires a cast of - the 'data_ptr_addr' argument that defeats type checking and can - cause subtle bugs. - 'name', 'dir', 'data_ptr_addr' and 'comp_id' are the same as in - the functions above. - 'type' is the hal type of the new pin - the type of data that - will be passed in/out of the component through the new pin. - If successful, hal_pin_new() returns 0. On failure - it returns a negative error code. -*/ -extern int hal_pin_new(const char *name, hal_type_t type, hal_pin_dir_t dir, - void **data_ptr_addr, int comp_id) __HAL_DEPRECATED("Use hal_pin_new_XXXX()"); +// +// The 'hal_pin_new_xxxx()' functions create a new 'pin' object. +// +// Once a pin has been created, it can be linked to a signal object using +// hal_link(). A pin contains a pointer, and the component that owns the pin +// can dereference the pointer to access whatever signal is linked to the pin. +// (If no signal is linked, it points to a dummy signal.) +// +// There are seven (five) functions, one for each of the data types that the +// HAL supports. Pins may only be linked to signals of the same type. +// +// - 'comp_id' is the ID of the component that will 'own' the variable. +// Normally it should be the ID of the caller, but in some cases, a user +// mode component may be doing setup for a realtime component, so the ID +// should be that of the realtime component that will actually be using the +// pin. +// - 'dir' is the pin direction. It indicates whether the pin is an input or +// output from the component. +// - 'ref' is the address of the pointer that the component will use for the +// pin. When the pin is linked to a signal, the pointer at 'data_ptr_addr' +// will be changed to point to the signal data location. The 'ref' must +// point to memory allocated by hal_malloc(). Typically the component +// allocates space for a data structure with hal_malloc(), and 'ref' is the +// address of a member of that structure. +// - 'def' is the default value of the pin. The unconnected pin's value (any +// direction) will be set to the value 'def'. +// - 'fmt' is the name of the new pin. It must be no longer than HAL_NAME_LEN. +// If there is already a pin with the same name the call will fail. +// +// If successful, the hal_pin_xxx_new() functions return zero (0). On failure +// they return a negative error code. +// +int hal_pin_new_bool(int compid, hal_pdir_t dir, hal_bool_t *ref, rtapi_bool def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_pin_new_si32(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_s32 def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_pin_new_ui32(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_u32 def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_pin_new_sint(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_sint def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_pin_new_uint(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_uint def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_pin_new_real(int compid, hal_pdir_t dir, hal_real_t *ref, rtapi_real def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_pin_new_port(int compid, hal_pdir_t dir, hal_port_t *ref, const char *fmt, ...) __HAL_PFMT(4,5); /** There is no 'hal_pin_delete()' function. Once a component has created a pin, that pin remains as long as the component exists. @@ -740,7 +657,7 @@ extern int hal_pin_new(const char *name, hal_type_t type, hal_pin_dir_t dir, original name or the alias. Calling this function with 'alias' set to NULL will remove any existing alias. */ -extern int hal_pin_alias(const char *pin_name, const char *alias); +int hal_pin_alias(const char *pin_name, const char *alias); /*********************************************************************** @@ -764,7 +681,7 @@ extern int hal_pin_alias(const char *pin_name, const char *alias); If successful, 'hal_signal_new() returns 0. On failure it returns a negative error code. */ -extern int hal_signal_new(const char *name, hal_type_t type); +int hal_signal_new(const char *name, hal_type_t type); /** 'hal_signal_delete()' deletes a signal object. Any pins linked to the object are unlinked. @@ -772,7 +689,7 @@ extern int hal_signal_new(const char *name, hal_type_t type); If successful, 'hal_signal_delete()' returns 0. On failure, it returns a negative error code. */ -extern int hal_signal_delete(const char *name); +int hal_signal_delete(const char *name); /** 'hal_link()' links a pin to a signal. 'pin_name' and 'sig_name' are strings containing the pin and signal names. If the pin is already @@ -785,109 +702,61 @@ extern int hal_signal_delete(const char *name); On success, hal_link() returns 0, on failure it returns a negative error code. */ -extern int hal_link(const char *pin_name, const char *sig_name); +int hal_link(const char *pin_name, const char *sig_name); /** 'hal_unlink()' unlinks any signal from the specified pin. 'pin_name' is a string containing the pin name. On success, hal_unlink() returns 0, on failure it returns a negative error code. */ -extern int hal_unlink(const char *pin_name); +int hal_unlink(const char *pin_name); /*********************************************************************** * "PARAMETER" FUNCTIONS * ************************************************************************/ - -/** The 'hal_param_xxx_new()' functions create a new 'parameter' object. - A parameter is a value that is only used inside a component, but may - need to be initialized or adjusted from outside the component to set - up the system properly. - Once a parameter has been created, it's value can be changed using - the 'hal_param_xxx_set()' functions. - There are eight functions, one for each of the data types that - the HAL supports. Pins may only be linked to signals of the same - type. - 'name' is the name of the new parameter. It must be no longer than - .HAL_NAME_LEN. If there is already a parameter with the same - name the call will fail. - 'dir' is the parameter direction. HAL_RO parameters are read only from - outside, and are written to by the component itself, typically to provide a - view "into" the component for testing or troubleshooting. HAL_RW - parameters are writable from outside and also sometimes modified by the - component itself as well. - 'data_addr' is the address where the value of the parameter is to be - stored. 'data_addr' must point to memory allocated by hal_malloc(). - Typically the component allocates space for a data structure with - hal_malloc(), and 'data_addr' is the address of a member of that - structure. Creating the parameter does not initialize or modify the - value at *data_addr - the component should load a reasonable default - value. - 'comp_id' is the ID of the component that will 'own' the parameter. - Normally it should be the ID of the caller, but in some cases, a - user mode component may be doing setup for a realtime component, so - the ID should be that of the realtime component that will actually - be using the parameter. - If successful, the hal_param_xxx_new() functions return 0. - On failure they return a negative error code. -*/ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -extern int hal_param_bit_new(const char *name, hal_param_dir_t dir, - hal_bit_t * data_addr, int comp_id) __HAL_DEPRECATED("Use hal_param_new_bool()"); -extern int hal_param_float_new(const char *name, hal_param_dir_t dir, - hal_float_t * data_addr, int comp_id) __HAL_DEPRECATED("Use hal_param_new_real()"); -extern int hal_param_u32_new(const char *name, hal_param_dir_t dir, - hal_u32_t * data_addr, int comp_id) __HAL_DEPRECATED("Use hal_param_new_ui32()"); -extern int hal_param_s32_new(const char *name, hal_param_dir_t dir, - hal_s32_t * data_addr, int comp_id) __HAL_DEPRECATED("Use hal_param_new_si32()"); -extern int hal_param_u64_new(const char *name, hal_param_dir_t dir, - hal_u64_t * data_addr, int comp_id) __HAL_DEPRECATED("Use hal_param_new_uint()"); -extern int hal_param_s64_new(const char *name, hal_param_dir_t dir, - hal_s64_t * data_addr, int comp_id) __HAL_DEPRECATED("Use hal_param_new_sint()"); - -/** printf_style-style versions of hal_param_XXX_new */ -extern int hal_param_bit_newf(hal_param_dir_t dir, - hal_bit_t * data_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_param_new_bool()"); -extern int hal_param_float_newf(hal_param_dir_t dir, - hal_float_t * data_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_param_new_real()"); -extern int hal_param_u32_newf(hal_param_dir_t dir, - hal_u32_t * data_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_param_new_ui32()"); -extern int hal_param_s32_newf(hal_param_dir_t dir, - hal_s32_t * data_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_param_new_si32()"); -extern int hal_param_u64_newf(hal_param_dir_t dir, - hal_u64_t * data_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_param_new_uint()"); -extern int hal_param_s64_newf(hal_param_dir_t dir, - hal_s64_t * data_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_param_new_sint()"); -#pragma GCC diagnostic pop - - -/** 'hal_param_new()' creates a new 'parameter' object. It is a generic - version of the eight functions above. It is provided ONLY for those - special cases where a generic function is needed. It is STRONGLY - recommended that the functions above be used instead, because they - check the type of 'data_addr' against the parameter type at compile - time. Using this function requires a cast of the 'data_addr' argument - that defeats type checking and can cause subtle bugs. - 'name', 'data_addr' and 'comp_id' are the same as in the - functions above. - 'type' is the hal type of the new parameter - the type of data - that will be stored in the parameter. - 'dir' is the parameter direction. HAL_RO parameters are read only from - outside, and are written to by the component itself, typically to provide a - view "into" the component for testing or troubleshooting. HAL_RW - parameters are writable from outside and also sometimes modified by the - component itself as well. - If successful, hal_param_new() returns 0. On failure - it returns a negative error code. -*/ -extern int hal_param_new(const char *name, hal_type_t type, hal_param_dir_t dir, - void *data_addr, int comp_id) __HAL_DEPRECATED("Use hal_param_new_XXXX()"); +// +// The 'hal_param_xxx_new()' functions create a new 'parameter' object. +// +// A parameter is a value that is only used inside a component, but may need to +// be initialized or adjusted from outside the component to set up the system +// properly. A parameter is, just like pins an opaque pointer. +// +// Once a parameter has been created, it's value can be changed using the +// appropriate hal_set_XXX() function for the respective type. There are seven +// (five) functions, one for each of the data types that the HAL supports. +// Parameters cannot be linked to signals. +// +// - 'comp_id' is the ID of the component that will 'own' the parameter. +// Normally it should be the ID of the caller, but in some cases, a user +// mode component may be doing setup for a realtime component, so the ID +// should be that of the realtime component that will actually be using the +// parameter. +// - 'dir' is the parameter direction. HAL_RO parameters are read only from +// outside, and are written to by the component itself, typically to +// provide a view "into" the component for testing or troubleshooting. +// HAL_RW parameters are writable from outside and also sometimes modified +// by the component itself as well. +// - 'ref' is the address where the pointer reference of where the parameter is +// to be stored. 'ref' must point to memory allocated by hal_malloc(). +// Typically the component allocates space for a data structure with +// hal_malloc(), and 'ref' is the address of a member of that structure. +// - 'def' is the default value of the parameter. The default value willbe set +// when the parameter is created. +// - 'fmt' is the name of the new parameter. It must be no longer than +// HAL_NAME_LEN. If there is already a parameter with the same name the +// call will fail. +// Both parameters and pins share the name space and a name must be unique. +// +// If successful, the hal_param_new_xxxx() functions return zero (0). On +// failure they return a negative error code. +// +int hal_param_new_bool(int compid, hal_pdir_t dir, hal_bool_t *ref, rtapi_bool def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_param_new_si32(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_s32 def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_param_new_ui32(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_u32 def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_param_new_sint(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_sint def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_param_new_uint(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_uint def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_param_new_real(int compid, hal_pdir_t dir, hal_real_t *ref, rtapi_real def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_param_new_fake(int compid, hal_refs_u *refs); /** There is no 'hal_param_delete()' function. Once a component has created a parameter, that parameter remains as long as the @@ -895,86 +764,12 @@ extern int hal_param_new(const char *name, hal_type_t type, hal_param_dir_t dir, removed when the component calls 'hal_exit()'. */ -/** The 'hal_param_xxx_set()' functions modify the value of a parameter. - 'name' is the name of the parameter that is to be set. The - parameter type must match the function type, and the parameter - must not be read-only. - 'value' is the value to be loaded into the parameter. - On success, the hal_param_xxx_set() functions return 0, - and on failure they return a negative error code. -*/ -int hal_param_bit_set(const char *name, int value) __HAL_DEPRECATED("Use hal_set_p()"); -int hal_param_float_set(const char *name, double value) __HAL_DEPRECATED("Use hal_set_p()"); -int hal_param_u32_set(const char *name, unsigned long value) __HAL_DEPRECATED("Use hal_set_p()"); -int hal_param_s32_set(const char *name, signed long value) __HAL_DEPRECATED("Use hal_set_p()"); -int hal_param_u64_set(const char *name, unsigned long value) __HAL_DEPRECATED("Use hal_set_p()"); -int hal_param_s64_set(const char *name, signed long value) __HAL_DEPRECATED("Use hal_set_p()"); - /** 'hal_param_alias()' assigns an alternate name, aka an alias, to a parameter. Once assigned, the parameter can be referred to by either its original name or the alias. Calling this function with 'alias' set to NULL will remove any existing alias. */ -extern int hal_param_alias(const char *pin_name, const char *alias); - -/** 'hal_param_set()' is a generic function that sets the value of a - parameter. It is provided ONLY for those special cases where a - generic function is needed. It is STRONGLY recommended that the - functions above be used instead, because they are simpler and less - prone to errors. - 'name', is the same as in the functions above. - 'type' is the hal type of the the data at *value_addr, and must - match the type of the parameter. The parameter must not be - read only. - 'value_addr' is a pointer to the new value of the parameter. - The data at that location will be interpreted according to the - type of the parameter. - If successful, hal_param_set() returns 0. On failure - it returns a negative error code. -*/ -int hal_param_set(const char *name, hal_type_t type, void *value_addr) __HAL_DEPRECATED("Use hal_set_p()"); - -/*********************************************************************** -* PIN/SIG/PARAM GETTER FUNCTIONS * -************************************************************************/ - -/** 'hal_get_pin_value_by_name()' gets the value of any arbitrary HAL pin by - * pin name. - * - * The 'type' and 'data' args are pointers to the returned values. The function - * returns 0 if successful, or -1 on error. If 'connected' is non-NULL, its - * value will be true if a signal is connected. - */ - -// We don't want our library to emit the deprecation warning. -// We already know it and need to provide them until removed. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -extern int hal_get_pin_value_by_name( - const char *name, hal_type_t *type, hal_data_u **data, bool *connected) __HAL_DEPRECATED("Use hal_get_p()"); - -/** 'hal_get_signal_value_by_name()' returns the value of any arbitrary HAL - * signal by signal name. - * - * The 'type' and 'data' args are pointers to the returned values. The function - * returns 0 if successful, or -1 on error. If 'has_writers' is non-NULL, its - * value will be true if the signal has writers. - */ - -extern int hal_get_signal_value_by_name( - const char *name, hal_type_t *type, hal_data_u **data, bool *has_writers) __HAL_DEPRECATED("Use hal_get_s()"); - -/** 'hal_get_param_value_by_name()' returns the value of any arbitrary HAL - * parameter by parameter name. - * - * The 'type' and 'data' args are pointers to the returned values. The function - * returns 0 if successful, or -1 on error. - */ - -extern int hal_get_param_value_by_name( - const char *name, hal_type_t *type, hal_data_u **data) __HAL_DEPRECATED("Use hal_get_p()"); -#pragma GCC diagnostic pop - +int hal_param_alias(const char *pin_name, const char *alias); /*********************************************************************** * EXECUTION RELATED FUNCTIONS * @@ -998,9 +793,6 @@ extern int hal_get_param_value_by_name( C function will be exported several times with different HAL names, perhaps to deal with multiple instances of a hardware device. - 'uses_fp' is deprecated and ignored. All threads now - unconditionally save and restore FPU/SSE state. This - parameter will be removed in a future version. 'reentrant' should be zero unless the function (and any hardware it accesses) is completely reentrant. If reentrant is non-zero, the function may be prempted and called again @@ -1012,16 +804,16 @@ extern int hal_get_param_value_by_name( Call only from realtime init code, not from user space or realtime code. */ -extern int hal_export_funct(const char *name, void (*funct) (void *, long), - void *arg, int uses_fp, int reentrant, int comp_id); +int hal_export_funct(const char *name, void (*funct) (void *, long), + void *arg, int reentrant, int comp_id); /** hal_export_functf is similar to hal_export_funct except that it also does printf-style formatting to compute the function name. If successful, it returns 0. On failure it returns a negative error code. */ -extern int hal_export_functf(void (*funct) (void *, long), - void *arg, int uses_fp, int reentrant, int comp_id, const char *fmt, ...); +int hal_export_functf(void (*funct) (void *, long), + void *arg, int reentrant, int comp_id, const char *fmt, ...); /** hal_create_thread() establishes a realtime thread that will execute one or more HAL functions periodically. @@ -1035,16 +827,12 @@ extern int hal_export_functf(void (*funct) (void *, long), threads that are created later, so creating them from fastest to slowest results in rate monotonic priority scheduling, usually a good thing. - 'uses_fp' is deprecated and ignored. All threads now - unconditionally save and restore FPU/SSE state. This - parameter will be removed in a future version. On success, hal_create_thread() returns a positive integer thread ID. On failure, returns an error code as defined above. Call only from realtime init code, not from user space or realtime code. */ -extern int hal_create_thread(const char *name, unsigned long period_nsec, - int uses_fp); +int hal_create_thread(const char *name, unsigned long period_nsec); /** hal_thread_delete() deletes a realtime thread. 'name' is the name of the thread, which must have been created @@ -1054,7 +842,7 @@ extern int hal_create_thread(const char *name, unsigned long period_nsec, Call only from realtime init code, not from user space or realtime code. */ -extern int hal_thread_delete(const char *name); +int hal_thread_delete(const char *name); #endif /* RTAPI */ @@ -1079,8 +867,7 @@ extern int hal_thread_delete(const char *name); only from within user space or init code, not from realtime code. */ -extern int hal_add_funct_to_thread(const char *funct_name, const char *thread_name, - int position); +int hal_add_funct_to_thread(const char *funct_name, const char *thread_name, int position); /** hal_init_funct_to_thread() registers a function to run exactly once, in the realtime context of 'thread_name', before the thread executes @@ -1099,7 +886,7 @@ extern int hal_add_funct_to_thread(const char *funct_name, const char *thread_na have no effect. Returns 0, -EALREADY, or a negative error code. Call only from user space or init code, not from realtime code. */ -extern int hal_init_funct_to_thread(const char *funct_name, const char *thread_name, int position); +int hal_init_funct_to_thread(const char *funct_name, const char *thread_name, int position); /** hal_del_funct_from_thread() removes a function from a thread. 'funct_name' is the name of the function, as specified in @@ -1110,14 +897,14 @@ extern int hal_init_funct_to_thread(const char *funct_name, const char *thread_n only from within user space or init code, not from realtime code. */ -extern int hal_del_funct_from_thread(const char *funct_name, const char *thread_name); +int hal_del_funct_from_thread(const char *funct_name, const char *thread_name); /** hal_start_threads() starts all threads that have been created. This is the point at which realtime functions start being called. On success it returns 0, on failure a negative error code. */ -extern int hal_start_threads(void); +int hal_start_threads(void); /** hal_stop_threads() stops all threads that were previously started by hal_start_threads(). It should be called before @@ -1125,7 +912,7 @@ extern int hal_start_threads(void); On success it returns 0, on failure a negative error code. */ -extern int hal_stop_threads(void); +int hal_stop_threads(void); /** HAL 'constructor' typedef If it is not NULL, this points to a function which can construct a new @@ -1136,7 +923,7 @@ typedef int(*constructor)(const char *prefix, const char *arg); /** hal_set_constructor() sets the constructor function for this component */ -extern int hal_set_constructor(int comp_id, constructor make); +int hal_set_constructor(int comp_id, constructor make); @@ -1161,7 +948,7 @@ extern int hal_set_constructor(int comp_id, constructor make); true: count bytes were read into dest false: no bytes were read into dest */ -extern bool hal_port_read(const hal_port_t *port, char* dest, unsigned count); +bool hal_port_read(const hal_port_t port, char* dest, unsigned count); /** hal_port_peek operates the same as hal_port_read but no bytes are consumed @@ -1171,7 +958,7 @@ extern bool hal_port_read(const hal_port_t *port, char* dest, unsigned count); true: count bytes were read into dest false: no bytes were read into dest */ -extern bool hal_port_peek(const hal_port_t *port, char* dest, unsigned count); +bool hal_port_peek(const hal_port_t port, char* dest, unsigned count); /** hal_port_peek_commit advances the read position in the port buffer by count bytes. A hal_port_peek followed by a hal_port_peek_commit @@ -1182,7 +969,7 @@ extern bool hal_port_peek(const hal_port_t *port, char* dest, unsigned count); true: count readable bytes were skipped and are no longer accessible false: no bytes wer skipped */ -extern bool hal_port_peek_commit(const hal_port_t *port, unsigned count); +bool hal_port_peek_commit(const hal_port_t port, unsigned count); /** hal_port_write writes count bytes from src into the port. This function should only be called by the component that owns @@ -1192,40 +979,40 @@ extern bool hal_port_peek_commit(const hal_port_t *port, unsigned count); false: no bytes were written into dest */ -extern bool hal_port_write(const hal_port_t *port, const char* src, unsigned count); +bool hal_port_write(const hal_port_t port, const char* src, unsigned count); /** hal_port_readable returns the number of bytes available for reading from the port. */ -extern unsigned hal_port_readable(const hal_port_t *port); +unsigned hal_port_readable(const hal_port_t port); /** hal_port_writable returns the number of bytes that can be written into the port */ -extern unsigned hal_port_writable(const hal_port_t *port); +unsigned hal_port_writable(const hal_port_t port); /** hal_port_buffer_size returns the total number of bytes that a port can buffer */ -extern unsigned hal_port_buffer_size(const hal_port_t *port); +unsigned hal_port_buffer_size(const hal_port_t port); /** hal_port_clear emptys a given port of all data without consuming any of it. hal_port_clear should only be called by a reader */ -extern void hal_port_clear(const hal_port_t *port); +void hal_port_clear(const hal_port_t port); #ifdef ULAPI /** hal_port_wait_readable spin waits on a port until it has at least count bytes available for reading, or *stop > 0 */ -extern void hal_port_wait_readable(hal_port_t** port, unsigned count, sig_atomic_t* stop); +void hal_port_wait_readable(const hal_port_t port, unsigned count, sig_atomic_t *stop); /** hal_port_wait_writable spin waits on a port until it has at least count bytes available for writing or *stop > 0 */ -extern void hal_port_wait_writable(hal_port_t** port, unsigned count, sig_atomic_t* stop); +void hal_port_wait_writable(const hal_port_t port, unsigned count, sig_atomic_t *stop); #endif @@ -1239,10 +1026,8 @@ extern void hal_port_wait_writable(hal_port_t** port, unsigned count, sig_atomic typedef union hal_stream_data { rtapi_real f; rtapi_bool b; - rtapi_s32 s; - rtapi_u32 u; - rtapi_sint l; - rtapi_uint k; + union { rtapi_sint s, l; }; + union { rtapi_uint u, k; }; } hal_stream_data_u; typedef hal_stream_data_u *hal_stream_data_ptr_u; @@ -1257,34 +1042,34 @@ typedef hal_stream_t *hal_stream_ptr_t; #define HAL_STREAM_MAX_PINS (21) /** create and attach a stream */ -extern int hal_stream_create(hal_stream_t *stream, int comp, int key, unsigned depth, const char *typestring); +int hal_stream_create(hal_stream_t *stream, int comp, int key, unsigned depth, const char *typestring); /** detach and destroy an open stream */ -extern void hal_stream_destroy(hal_stream_t *stream); +void hal_stream_destroy(hal_stream_t *stream); /** attach to an existing stream */ -extern int hal_stream_attach(hal_stream_t *stream, int comp, int key, const char *typestring); +int hal_stream_attach(hal_stream_t *stream, int comp, int key, const char *typestring); /** detach from an open stream */ -extern int hal_stream_detach(hal_stream_t *stream); +int hal_stream_detach(hal_stream_t *stream); /** stream introspection */ -extern int hal_stream_element_count(hal_stream_t *stream); -extern hal_type_t hal_stream_element_type(hal_stream_t *stream, int idx); +int hal_stream_element_count(hal_stream_t *stream); +hal_type_t hal_stream_element_type(hal_stream_t *stream, int idx); // only one reader and one writer is allowed. -extern int hal_stream_read(hal_stream_t *stream, hal_stream_data_u *buf, unsigned *sampleno); -extern bool hal_stream_readable(hal_stream_t *stream); -extern int hal_stream_depth(hal_stream_t *stream); -extern unsigned hal_stream_maxdepth(hal_stream_t *stream); -extern int hal_stream_num_underruns(hal_stream_t *stream); -extern int hal_stream_num_overruns(hal_stream_t *stream); +int hal_stream_read(hal_stream_t *stream, hal_stream_data_u *buf, unsigned *sampleno); +bool hal_stream_readable(hal_stream_t *stream); +int hal_stream_depth(hal_stream_t *stream); +unsigned hal_stream_maxdepth(hal_stream_t *stream); +int hal_stream_num_underruns(hal_stream_t *stream); +int hal_stream_num_overruns(hal_stream_t *stream); #ifdef ULAPI -extern void hal_stream_wait_readable(hal_stream_t *stream, sig_atomic_t *stop); +void hal_stream_wait_readable(hal_stream_t *stream, sig_atomic_t *stop); #endif -extern int hal_stream_write(hal_stream_t *stream, hal_stream_data_u *buf); -extern bool hal_stream_writable(hal_stream_t *stream); +int hal_stream_write(hal_stream_t *stream, hal_stream_data_u *buf); +bool hal_stream_writable(hal_stream_t *stream); #ifdef ULAPI -extern void hal_stream_wait_writable(hal_stream_t *stream, sig_atomic_t *stop); +void hal_stream_wait_writable(hal_stream_t *stream, sig_atomic_t *stop); #endif @@ -1293,17 +1078,6 @@ extern void hal_stream_wait_writable(hal_stream_t *stream, sig_atomic_t *stop); ************************************************************************/ -/** HAL_STATIC_ASSERT wrapper for compile time asserts -*/ -#if __STDC_VERSION__ >= 202311L || defined(__cplusplus) -#define HAL_STATIC_ASSERT(expression, message) static_assert((expression), message) -#else -/* _Static_assert: GCC extension, in C standard since C11, deprecated in favour of - static_assert (like C++) from C23 onwards*/ -#define HAL_STATIC_ASSERT(expression, message) _Static_assert((expression), message) -#endif - - /** hal_extend_counter() extends a counter value with nbits to 64 bits. For some hardware counters or encoders it may be desireable to @@ -1644,4 +1418,8 @@ int hal_enforce_exact_base_period(void); RTAPI_END_DECLS +#undef __HAL_PFMT +#undef __HAL_ALWAYS_INLINE +#undef __HAL_DEPRECATED + #endif /* HAL_H */ diff --git a/src/hal/hal_lib.c b/src/hal/hal_lib.c index ce5cbc68713..d05c01d59f6 100644 --- a/src/hal/hal_lib.c +++ b/src/hal/hal_lib.c @@ -778,10 +778,10 @@ const char *hal_strerror(int err) } } -char *hal_comp_name(int comp_id) +const char *hal_comp_name(int comp_id) { hal_comp_t *comp; - char *result = NULL; + const char *result = NULL; halpr_mutex_acquire(); comp = halpr_find_comp_by_id(comp_id); if(comp) result = comp->name; @@ -835,240 +835,9 @@ unsigned char hal_get_lock() { * "PIN" FUNCTIONS * ************************************************************************/ -/* wrapper functs for typed pins - these call the generic funct below */ - -// We don't want our library to emit the deprecation warning. -// We already know it and need to provide them until removed. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -int hal_pin_bit_new(const char *name, hal_pin_dir_t dir, - hal_bit_t ** data_ptr_addr, int comp_id) -{ - return hal_pin_new(name, HAL_BIT, dir, (void **) data_ptr_addr, comp_id); -} - -int hal_pin_float_new(const char *name, hal_pin_dir_t dir, - hal_float_t ** data_ptr_addr, int comp_id) -{ - return hal_pin_new(name, HAL_FLOAT, dir, (void **) data_ptr_addr, - comp_id); -} - -int hal_pin_u32_new(const char *name, hal_pin_dir_t dir, - hal_u32_t ** data_ptr_addr, int comp_id) -{ - return hal_pin_new(name, HAL_U32, dir, (void **) data_ptr_addr, comp_id); -} - -int hal_pin_s32_new(const char *name, hal_pin_dir_t dir, - hal_s32_t ** data_ptr_addr, int comp_id) -{ - return hal_pin_new(name, HAL_S32, dir, (void **) data_ptr_addr, comp_id); -} - -int hal_pin_u64_new(const char *name, hal_pin_dir_t dir, - hal_u64_t ** data_ptr_addr, int comp_id) -{ - return hal_pin_new(name, HAL_U64, dir, (void **) data_ptr_addr, comp_id); -} - -int hal_pin_s64_new(const char *name, hal_pin_dir_t dir, - hal_s64_t ** data_ptr_addr, int comp_id) -{ - return hal_pin_new(name, HAL_S64, dir, (void **) data_ptr_addr, comp_id); -} - -int hal_pin_port_new(const char *name, hal_pin_dir_t dir, - hal_port_t ** data_ptr_addr, int comp_id) -{ - return hal_pin_new(name, HAL_PORT, dir, (void **)data_ptr_addr, comp_id); -} - - -static int hal_pin_newfv(hal_type_t type, hal_pin_dir_t dir, - void ** data_ptr_addr, int comp_id, const char *fmt, va_list ap) -{ - char name[HAL_NAME_LEN + 1]; - int sz; - sz = rtapi_vsnprintf(name, sizeof(name), fmt, ap); - if(sz == -1 || sz > HAL_NAME_LEN) { - rtapi_print_msg(RTAPI_MSG_ERR, - "hal_pin_newfv: length %d too long for name starting '%s'\n", - sz, name); - return -ENOMEM; - } - return hal_pin_new(name, type, dir, data_ptr_addr, comp_id); -} - -int hal_pin_bit_newf(hal_pin_dir_t dir, - hal_bit_t ** data_ptr_addr, int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_pin_newfv(HAL_BIT, dir, (void**)data_ptr_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_pin_float_newf(hal_pin_dir_t dir, - hal_float_t ** data_ptr_addr, int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_pin_newfv(HAL_FLOAT, dir, (void**)data_ptr_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_pin_u32_newf(hal_pin_dir_t dir, - hal_u32_t ** data_ptr_addr, int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_pin_newfv(HAL_U32, dir, (void**)data_ptr_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_pin_s32_newf(hal_pin_dir_t dir, - hal_s32_t ** data_ptr_addr, int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_pin_newfv(HAL_S32, dir, (void**)data_ptr_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_pin_u64_newf(hal_pin_dir_t dir, - hal_u64_t ** data_ptr_addr, int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_pin_newfv(HAL_U64, dir, (void**)data_ptr_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_pin_s64_newf(hal_pin_dir_t dir, - hal_s64_t ** data_ptr_addr, int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_pin_newfv(HAL_S64, dir, (void**)data_ptr_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} -#pragma GCC diagnostic pop - -int hal_pin_port_newf(hal_pin_dir_t dir, - hal_port_t **data_ptr_addr, int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_pin_newfv(HAL_PORT, dir, (void**)data_ptr_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -// *** New interface *** - -int hal_pin_new_bool(int compid, hal_pdir_t dir, hal_bool_t *ref, rtapi_bool def, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int ret = hal_pin_newfv(HAL_BIT, dir, (void**)ref, compid, fmt, ap); - va_end(ap); - if(ret) - return ret; - hal_set_bool(*ref, def); - return 0; -} - -int hal_pin_new_si32(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_s32 def, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int ret = hal_pin_newfv(HAL_S32, dir, (void**)ref, compid, fmt, ap); - va_end(ap); - if(ret) - return ret; - hal_set_si32(*ref, def); - return 0; -} - -int hal_pin_new_ui32(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_u32 def, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int ret = hal_pin_newfv(HAL_U32, dir, (void**)ref, compid, fmt, ap); - va_end(ap); - if(ret) - return ret; - hal_set_ui32(*ref, def); - return 0; -} - -int hal_pin_new_sint(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_sint def, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int ret = hal_pin_newfv(HAL_S64, dir, (void**)ref, compid, fmt, ap); - va_end(ap); - if(ret) - return ret; - hal_set_sint(*ref, def); - return 0; -} - -int hal_pin_new_uint(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_uint def, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int ret = hal_pin_newfv(HAL_U64, dir, (void**)ref, compid, fmt, ap); - va_end(ap); - if(ret) - return ret; - hal_set_uint(*ref, def); - return 0; -} - -int hal_pin_new_real(int compid, hal_pdir_t dir, hal_real_t *ref, rtapi_real def, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int ret = hal_pin_newfv(HAL_FLOAT, dir, (void**)ref, compid, fmt, ap); - va_end(ap); - if(ret) - return ret; - hal_set_real(*ref, def); - return 0; -} - -// Note: port has no initial default as it is an 'internal' reference -//int hal_pin_new_port(int compid, hal_pdir_t dir, hal_port_t *ref, const char *fmt, ...) -// FIXME: This needs to change into hal_port_t argument when we break the API -// It is here so we may add halmodule without too much trouble until then. -int hal_pin_new_port(int compid, hal_pdir_t dir, hal_sint_t *ref, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int ret = hal_pin_newfv(HAL_PORT, dir, (void**)ref, compid, fmt, ap); - va_end(ap); - return ret; -} - /* this is a generic function that does the majority of the work. */ -int hal_pin_new(const char *name, hal_type_t type, hal_pin_dir_t dir, - void **data_ptr_addr, int comp_id) +static int halpr_pin_new(const char *name, hal_type_t type, hal_pdir_t dir, void **data_ptr_addr, int comp_id) { rtapi_intptr_t *prev, next; int cmp; @@ -1081,18 +850,25 @@ int hal_pin_new(const char *name, hal_type_t type, hal_pin_dir_t dir, return -EFAULT; } - if(*data_ptr_addr) + if(*data_ptr_addr) { rtapi_print_msg(RTAPI_MSG_ERR, "HAL: ERROR: pin_new(%s) called with already-initialized memory\n", name); } - if (type != HAL_BIT && type != HAL_FLOAT && type != HAL_S32 && type != HAL_U32 && type != HAL_S64 && type != HAL_U64 && type != HAL_PORT) { - rtapi_print_msg(RTAPI_MSG_ERR, - "HAL: ERROR: pin type not one of HAL_BIT, HAL_FLOAT, HAL_S32, HAL_U32, HAL_S64, HAL_U64 or HAL_PORT\n"); - return -EINVAL; + switch(type) { + case HAL_BOOL: + case HAL_REAL: + case HAL_SINT: + case HAL_UINT: + case HAL_PORT: + break; + default: + rtapi_print_msg(RTAPI_MSG_ERR, + "HAL: ERROR: pin type not one of HAL_BOOL, HAL_REAL, HAL_SINT, HAL_UINT or HAL_PORT\n"); + return -EINVAL; } - + if(dir != HAL_IN && dir != HAL_OUT && dir != HAL_IO) { rtapi_print_msg(RTAPI_MSG_ERR, "HAL: ERROR: pin direction not one of HAL_IN, HAL_OUT, or HAL_IO\n"); @@ -1208,6 +984,110 @@ int hal_pin_new(const char *name, hal_type_t type, hal_pin_dir_t dir, } } +/* wrapper functs for typed pins - these call the generic funct below */ + +static int hal_pin_newfv(hal_type_t type, hal_pdir_t dir, + void ** data_ptr_addr, int comp_id, const char *fmt, va_list ap) +{ + char name[HAL_NAME_LEN + 1]; + int sz; + sz = rtapi_vsnprintf(name, sizeof(name), fmt, ap); + if(sz == -1 || sz > HAL_NAME_LEN) { + rtapi_print_msg(RTAPI_MSG_ERR, + "hal_pin_newfv: length %d too long for name starting '%s'\n", + sz, name); + return -ENOMEM; + } + return halpr_pin_new(name, type, dir, data_ptr_addr, comp_id); +} + +// *** New interface *** + +int hal_pin_new_bool(int compid, hal_pdir_t dir, hal_bool_t *ref, rtapi_bool def, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + int ret = hal_pin_newfv(HAL_BOOL, dir, (void**)ref, compid, fmt, ap); + va_end(ap); + if(ret) + return ret; + hal_set_bool(*ref, def); + return 0; +} + +int hal_pin_new_si32(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_s32 def, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + int ret = hal_pin_newfv(HAL_SINT, dir, (void**)ref, compid, fmt, ap); + va_end(ap); + if(ret) + return ret; + hal_set_si32(*ref, def); + return 0; +} + +int hal_pin_new_ui32(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_u32 def, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + int ret = hal_pin_newfv(HAL_UINT, dir, (void**)ref, compid, fmt, ap); + va_end(ap); + if(ret) + return ret; + hal_set_ui32(*ref, def); + return 0; +} + +int hal_pin_new_sint(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_sint def, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + int ret = hal_pin_newfv(HAL_SINT, dir, (void**)ref, compid, fmt, ap); + va_end(ap); + if(ret) + return ret; + hal_set_sint(*ref, def); + return 0; +} + +int hal_pin_new_uint(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_uint def, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + int ret = hal_pin_newfv(HAL_UINT, dir, (void**)ref, compid, fmt, ap); + va_end(ap); + if(ret) + return ret; + hal_set_uint(*ref, def); + return 0; +} + +int hal_pin_new_real(int compid, hal_pdir_t dir, hal_real_t *ref, rtapi_real def, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + int ret = hal_pin_newfv(HAL_REAL, dir, (void**)ref, compid, fmt, ap); + va_end(ap); + if(ret) + return ret; + hal_set_real(*ref, def); + return 0; +} + +// Note: port has no initial default as it is an 'internal' reference +int hal_pin_new_port(int compid, hal_pdir_t dir, hal_port_t *ref, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + int ret = hal_pin_newfv(HAL_PORT, dir, (void**)ref, compid, fmt, ap); + va_end(ap); + if(ret) + return ret; + hal_set_port(*ref, 0); // By definition, a port starts unallocated + return 0; +} + int hal_pin_alias(const char *pin_name, const char *alias) { rtapi_intptr_t *prev, next; @@ -1379,15 +1259,14 @@ int hal_signal_new(const char *name, hal_type_t type) */ switch (type) { case HAL_BOOL: - case HAL_S32: - case HAL_U32: case HAL_SINT: case HAL_UINT: case HAL_REAL: case HAL_PORT: data_addr = shmalloc_up(sizeof(*data_addr)); // Initialize the signal value - memset(data_addr, 0, sizeof(*data_addr)); + if(NULL != data_addr) + memset(data_addr, 0, sizeof(*data_addr)); break; default: halpr_mutex_release(); @@ -1604,8 +1483,6 @@ int hal_link(const char *pin_name, const char *sig_name) switch (pin->type) { case HAL_BOOL: - case HAL_S32: - case HAL_U32: case HAL_SINT: case HAL_UINT: case HAL_REAL: @@ -1683,126 +1560,6 @@ int hal_unlink(const char *pin_name) /* wrapper functs for typed params - these call the generic funct below */ -// We don't want our library to emit the deprecation warning. -// We already know it and need to provide them until removed. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -int hal_param_bit_new(const char *name, hal_param_dir_t dir, hal_bit_t * data_addr, - int comp_id) -{ - return hal_param_new(name, HAL_BIT, dir, (void *) data_addr, comp_id); -} - -int hal_param_float_new(const char *name, hal_param_dir_t dir, hal_float_t * data_addr, - int comp_id) -{ - return hal_param_new(name, HAL_FLOAT, dir, (void *) data_addr, comp_id); -} - -int hal_param_u32_new(const char *name, hal_param_dir_t dir, hal_u32_t * data_addr, - int comp_id) -{ - return hal_param_new(name, HAL_U32, dir, (void *) data_addr, comp_id); -} - -int hal_param_s32_new(const char *name, hal_param_dir_t dir, hal_s32_t * data_addr, - int comp_id) -{ - return hal_param_new(name, HAL_S32, dir, (void *) data_addr, comp_id); -} - -int hal_param_u64_new(const char *name, hal_param_dir_t dir, hal_u64_t * data_addr, - int comp_id) -{ - return hal_param_new(name, HAL_U64, dir, (void *) data_addr, comp_id); -} -int hal_param_s64_new(const char *name, hal_param_dir_t dir, hal_s64_t * data_addr, - int comp_id) -{ - return hal_param_new(name, HAL_S64, dir, (void *) data_addr, comp_id); -} - -static int hal_param_newfv(hal_type_t type, hal_param_dir_t dir, - void *data_addr, int comp_id, const char *fmt, va_list ap) { - char name[HAL_NAME_LEN + 1]; - int sz; - sz = rtapi_vsnprintf(name, sizeof(name), fmt, ap); - if(sz == -1 || sz > HAL_NAME_LEN) { - rtapi_print_msg(RTAPI_MSG_ERR, - "hal_param_newfv: length %d too long for name starting '%s'\n", - sz, name); - return -ENOMEM; - } - return hal_param_new(name, type, dir, (void *) data_addr, comp_id); -} - -int hal_param_bit_newf(hal_param_dir_t dir, hal_bit_t * data_addr, - int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_param_newfv(HAL_BIT, dir, (void*)data_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_param_float_newf(hal_param_dir_t dir, hal_float_t * data_addr, - int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_param_newfv(HAL_FLOAT, dir, (void*)data_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_param_u32_newf(hal_param_dir_t dir, hal_u32_t * data_addr, - int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_param_newfv(HAL_U32, dir, (void*)data_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_param_s32_newf(hal_param_dir_t dir, hal_s32_t * data_addr, - int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_param_newfv(HAL_S32, dir, (void*)data_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_param_u64_newf(hal_param_dir_t dir, hal_u64_t * data_addr, - int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_param_newfv(HAL_U64, dir, (void*)data_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_param_s64_newf(hal_param_dir_t dir, hal_s64_t * data_addr, - int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_param_newfv(HAL_S64, dir, (void*)data_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} -#pragma GCC diagnostic pop - /* this is a generic function that does the majority of the work. */ // The old API parameter style uses the 'data_addr' as the actual data storage @@ -1828,8 +1585,6 @@ static int hal_param_new_anyapi(const char *name, hal_type_t type, hal_pdir_t di case HAL_REAL: case HAL_SINT: case HAL_UINT: - case HAL_S32: - case HAL_U32: break; default: rtapi_print_msg(RTAPI_MSG_ERR, @@ -1951,13 +1706,6 @@ static int hal_param_new_anyapi(const char *name, hal_type_t type, hal_pdir_t di } } -// Old API interface -int hal_param_new(const char *name, hal_type_t type, hal_pdir_t dir, void *data_addr, - int comp_id) -{ - return hal_param_new_anyapi(name, type, dir, data_addr, comp_id, 0); -} - // New API interface only used locally static int hal_param_new_newapi(hal_type_t type, hal_pdir_t dir, void *data_addr, int comp_id, const char *fmt, va_list ap) @@ -1979,7 +1727,7 @@ int hal_param_new_bool(int compid, hal_pdir_t dir, hal_bool_t *ref, rtapi_bool d { va_list ap; va_start(ap, fmt); - int ret = hal_param_new_newapi(HAL_BIT, dir, ref, compid, fmt, ap); + int ret = hal_param_new_newapi(HAL_BOOL, dir, ref, compid, fmt, ap); va_end(ap); if(ret) return ret; @@ -1991,7 +1739,7 @@ int hal_param_new_si32(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_s32 de { va_list ap; va_start(ap, fmt); - int ret = hal_param_new_newapi(HAL_S32, dir, ref, compid, fmt, ap); + int ret = hal_param_new_newapi(HAL_SINT, dir, ref, compid, fmt, ap); va_end(ap); if(ret) return ret; @@ -2003,7 +1751,7 @@ int hal_param_new_ui32(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_u32 de { va_list ap; va_start(ap, fmt); - int ret = hal_param_new_newapi(HAL_U32, dir, ref, compid, fmt, ap); + int ret = hal_param_new_newapi(HAL_UINT, dir, ref, compid, fmt, ap); va_end(ap); if(ret) return ret; @@ -2015,7 +1763,7 @@ int hal_param_new_sint(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_sint d { va_list ap; va_start(ap, fmt); - int ret = hal_param_new_newapi(HAL_S64, dir, ref, compid, fmt, ap); + int ret = hal_param_new_newapi(HAL_SINT, dir, ref, compid, fmt, ap); va_end(ap); if(ret) return ret; @@ -2027,7 +1775,7 @@ int hal_param_new_uint(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_uint d { va_list ap; va_start(ap, fmt); - int ret = hal_param_new_newapi(HAL_U64, dir, ref, compid, fmt, ap); + int ret = hal_param_new_newapi(HAL_UINT, dir, ref, compid, fmt, ap); va_end(ap); if(ret) return ret; @@ -2039,7 +1787,7 @@ int hal_param_new_real(int compid, hal_pdir_t dir, hal_real_t *ref, rtapi_real d { va_list ap; va_start(ap, fmt); - int ret = hal_param_new_newapi(HAL_FLOAT, dir, ref, compid, fmt, ap); + int ret = hal_param_new_newapi(HAL_REAL, dir, ref, compid, fmt, ap); va_end(ap); if(ret) return ret; @@ -2064,125 +1812,6 @@ int hal_param_new_fake(int compid, hal_refs_u *ref) return 0; } -/* wrapper functs for typed params - these call the generic funct below */ - -// We don't want our library to emit the deprecation warning. -// We already know it and need to provide them until removed. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -int hal_param_bit_set(const char *name, int value) -{ - return hal_param_set(name, HAL_BIT, &value); -} - -int hal_param_float_set(const char *name, double value) -{ - return hal_param_set(name, HAL_FLOAT, &value); -} - -int hal_param_u32_set(const char *name, unsigned long value) -{ - return hal_param_set(name, HAL_U32, &value); -} - -int hal_param_s32_set(const char *name, signed long value) -{ - return hal_param_set(name, HAL_S32, &value); -} - -int hal_param_u64_set(const char *name, unsigned long value) -{ - return hal_param_set(name, HAL_U64, &value); -} - -int hal_param_s64_set(const char *name, signed long value) -{ - return hal_param_set(name, HAL_S64, &value); -} - -/* this is a generic function that does the majority of the work */ - -int hal_param_set(const char *name, hal_type_t type, void *value_addr) -{ - hal_param_t *param; - void *d_ptr; - - if (hal_data == NULL) { - rtapi_print_msg(RTAPI_MSG_ERR, - "HAL: ERROR: param_set called before init\n"); - return -EFAULT; - } - - if (hal_data->lock & HAL_LOCK_PARAMS) { - rtapi_print_msg(RTAPI_MSG_ERR, - "HAL: ERROR: param_set called while HAL locked\n"); - return -EPERM; - } - - rtapi_print_msg(RTAPI_MSG_DBG, "HAL: setting parameter '%s'\n", name); - /* get mutex before accessing shared data */ - halpr_mutex_acquire(); - - /* search param list for name */ - param = halpr_find_param_by_name(name); - if (param == NULL) { - /* parameter not found */ - halpr_mutex_release(); - rtapi_print_msg(RTAPI_MSG_ERR, - "HAL: ERROR: parameter '%s' not found\n", name); - return -EINVAL; - } - /* found it, is type compatible? */ - if (param->type != type) { - halpr_mutex_release(); - rtapi_print_msg(RTAPI_MSG_ERR, - "HAL: ERROR: type mismatch setting param '%s'\n", name); - return -EINVAL; - } - /* is it read only? */ - if (param->dir == HAL_RO) { - halpr_mutex_release(); - rtapi_print_msg(RTAPI_MSG_ERR, - "HAL: ERROR: param '%s' is not writable\n", name); - return -EINVAL; - } - /* everything is OK, set the value */ - d_ptr = SHMPTR(param->data_ptr); - switch (param->type) { - case HAL_BIT: - if (*((int *) value_addr) == 0) { - *(hal_bit_t *) (d_ptr) = 0; - } else { - *(hal_bit_t *) (d_ptr) = 1; - } - break; - case HAL_FLOAT: - *((hal_float_t *) (d_ptr)) = *((double *) (value_addr)); - break; - case HAL_S32: - *((hal_s32_t *) (d_ptr)) = *((signed long *) (value_addr)); - break; - case HAL_U32: - *((hal_u32_t *) (d_ptr)) = *((unsigned long *) (value_addr)); - break; - case HAL_S64: - *((hal_s64_t *) (d_ptr)) = *((signed long *) (value_addr)); - break; - case HAL_U64: - *((hal_u64_t *) (d_ptr)) = *((unsigned long *) (value_addr)); - break; - default: - /* Shouldn't get here, but just in case... */ - halpr_mutex_release(); - rtapi_print_msg(RTAPI_MSG_ERR, - "HAL: ERROR: bad type %d setting param\n", param->type); - return -EINVAL; - } - halpr_mutex_release(); - return 0; -} -#pragma GCC diagnostic pop - int hal_param_alias(const char *param_name, const char *alias) { rtapi_intptr_t *prev, next; @@ -2307,62 +1936,6 @@ int hal_param_alias(const char *param_name, const char *alias) } } -/*********************************************************************** -* PIN/SIG/PARAM GETTER FUNCTIONS * -************************************************************************/ - -// We don't want our library to emit the deprecation warning. -// We already know it and need to provide them until removed. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -int hal_get_pin_value_by_name( - const char *hal_name, hal_type_t *type, hal_data_u **data, bool *connected) -{ - hal_pin_t *pin; - hal_sig_t *sig; - if ((pin = halpr_find_pin_by_name(hal_name)) == NULL) - return -1; - - if (connected != NULL) - *connected = pin && pin->signal; - *type = pin->type; - if (pin->signal != 0) { - sig = (hal_sig_t *) SHMPTR(pin->signal); - *data = (hal_data_u *) SHMPTR(sig->data_ptr); - } else { - *data = (hal_data_u *) &(pin->dummysig); - } - return 0; -} - -int hal_get_signal_value_by_name( - const char *hal_name, hal_type_t *type, hal_data_u **data, bool *has_writers) -{ - hal_sig_t *sig; - if ((sig = halpr_find_sig_by_name(hal_name)) == NULL) - return -1; - - if (has_writers != NULL) - *has_writers = !!sig->writers; - *type = sig->type; - *data = (hal_data_u *) SHMPTR(sig->data_ptr); - return 0; -} - -int hal_get_param_value_by_name( - const char *hal_name, hal_type_t *type, hal_data_u **data) -{ - hal_param_t *param; - if ((param = halpr_find_param_by_name(hal_name)) == NULL) - return -1; - - *type = param->type; - *data = (hal_data_u *) SHMPTR(param->data_ptr); - return 0; -} -#pragma GCC diagnostic pop - - /*********************************************************************** * EXECUTION RELATED FUNCTIONS * ************************************************************************/ @@ -2370,7 +1943,7 @@ int hal_get_param_value_by_name( #ifdef RTAPI static int hal_export_functfv(void (*funct) (void *, long), - void *arg, int uses_fp, int reentrant, int comp_id, const char *fmt, va_list ap) + void *arg, int reentrant, int comp_id, const char *fmt, va_list ap) { char name[HAL_NAME_LEN + 1]; int sz; @@ -2381,24 +1954,23 @@ static int hal_export_functfv(void (*funct) (void *, long), sz, name); return -ENOMEM; } - return hal_export_funct(name, funct, arg, uses_fp, reentrant, comp_id); + return hal_export_funct(name, funct, arg, reentrant, comp_id); } int hal_export_functf(void (*funct) (void *, long), - void *arg, int uses_fp, int reentrant, int comp_id, const char *fmt, ...) + void *arg, int reentrant, int comp_id, const char *fmt, ...) { va_list ap; int ret; va_start(ap, fmt); - ret = hal_export_functfv(funct, arg, uses_fp, reentrant, comp_id, fmt, ap); + ret = hal_export_functfv(funct, arg, reentrant, comp_id, fmt, ap); va_end(ap); return ret; } int hal_export_funct(const char *name, void (*funct) (void *, long), - void *arg, int uses_fp, int reentrant, int comp_id) + void *arg, int reentrant, int comp_id) { - (void)uses_fp; rtapi_intptr_t *prev, next; int cmp; hal_funct_t *new, *fptr; @@ -2455,9 +2027,7 @@ int hal_export_funct(const char *name, void (*funct) (void *, long), "HAL: ERROR: insufficient memory for function '%s'\n", name); return -ENOMEM; } - /* initialize the structure. - uses_fp is deprecated and ignored; always report as FP-capable. */ - new->uses_fp = 1; + /* initialize the structure. */ new->owner_ptr = SHMOFF(comp); new->reentrant = reentrant; new->users = 0; @@ -2523,9 +2093,8 @@ int hal_export_funct(const char *name, void (*funct) (void *, long), return 0; } -int hal_create_thread(const char *name, unsigned long period_nsec, int uses_fp) +int hal_create_thread(const char *name, unsigned long period_nsec) { - (void)uses_fp; int next, cmp, prev_priority; int retval, n; hal_thread_t *new, *tptr; @@ -2582,9 +2151,7 @@ int hal_create_thread(const char *name, unsigned long period_nsec, int uses_fp) "HAL: ERROR: insufficient memory to create thread\n"); return -ENOMEM; } - /* initialize the structure. - uses_fp is deprecated and ignored; always enable FPU save/restore. */ - new->uses_fp = 1; + /* initialize the structure. */ rtapi_snprintf(new->name, sizeof(new->name), "%s", name); /* have to create and start a task to run the thread */ if (hal_data->thread_list_ptr == 0) { @@ -2644,10 +2211,8 @@ int hal_create_thread(const char *name, unsigned long period_nsec, int uses_fp) } /* make priority one lower than previous */ new->priority = rtapi_prio_next_lower(prev_priority); - /* create task - owned by library module, not caller. - Always pass 1 for uses_fp (deprecated, ignored by rtapi). */ - retval = rtapi_task_new(thread_task, new, new->priority, - lib_module_id, HAL_STACKSIZE, 1); + /* create task - owned by library module, not caller.*/ + retval = rtapi_task_new(thread_task, new, new->priority, lib_module_id, HAL_STACKSIZE); if (retval < 0) { halpr_mutex_release(); rtapi_print_msg(RTAPI_MSG_ERR, @@ -2832,9 +2397,6 @@ int hal_add_funct_to_thread(const char *funct_name, const char *thread_name, int "HAL: ERROR: thread '%s' not found\n", thread_name); return -EINVAL; } - /* uses_fp is deprecated and ignored; all threads are FP-capable. - The FP compatibility check has been removed since all threads - and functions now effectively have uses_fp=1. */ /* find insertion point */ list_root = &(thread->funct_list); list_entry = list_root; @@ -3995,7 +3557,6 @@ static hal_funct_t *alloc_funct_struct(void) if (p) { /* make sure it's empty */ p->next_ptr = 0; - p->uses_fp = 0; p->owner_ptr = 0; p->reentrant = 0; p->users = 0; @@ -4053,7 +3614,6 @@ static hal_thread_t *alloc_thread_struct(void) if (p) { /* make sure it's empty */ p->next_ptr = 0; - p->uses_fp = 0; p->period = 0; p->priority = 0; p->task_id = 0; @@ -4159,8 +3719,6 @@ static void unlink_pin(hal_pin_t * pin) switch (pin->type) { case HAL_BOOL: - case HAL_S32: - case HAL_U32: case HAL_SINT: case HAL_UINT: case HAL_REAL: @@ -4319,7 +3877,6 @@ static void free_funct_struct(hal_funct_t * funct) } } /* clear contents of struct */ - funct->uses_fp = 0; funct->owner_ptr = 0; funct->reentrant = 0; funct->users = 0; @@ -4368,7 +3925,6 @@ static void free_thread_struct(hal_thread_t * thread) rtapi_task_pause(thread->task_id); rtapi_task_delete(thread->task_id); /* clear contents of struct */ - thread->uses_fp = 0; thread->period = 0; thread->priority = 0; thread->task_id = 0; @@ -4517,7 +4073,7 @@ static bool hal_port_compute_copy(unsigned read, } -int halpr_port_alloc(unsigned size, hal_port_t *port) { +int halpr_port_alloc(unsigned size, hal_port_t port) { if(!port || size < 1 || size > HAL_PORT_SIZE_MAX) return -EINVAL; @@ -4531,32 +4087,33 @@ int halpr_port_alloc(unsigned size, hal_port_t *port) { new_port->write = 0; new_port->size = size; - *port = SHMOFF(new_port); + hal_set_port(port, SHMOFF(new_port)); return 0; } -static inline hal_port_shm_t *hal_port_to_shm(const hal_port_t *port) +static inline hal_port_shm_t *hal_port_to_shm(const hal_port_t port) { + HAL_STATIC_ASSERT(sizeof(rtapi_port) <= sizeof(rtapi_sint), "rtapi_port size larger than rtapi_sint"); hal_port_shm_t *shm; if(!port) return NULL; - long ofs = *port; + rtapi_port ofs = hal_get_port(port); // The offset must be positive non-zero // The offset must be modulo the magic field size (4 bytes) // The offset must not point beyond shared memory for the control structure - if(ofs <= 0 || 0 != (ofs & (long)(sizeof(shm->magic)-1)) || ofs > (long)(HAL_SIZE - sizeof(hal_port_shm_t))) + if(ofs <= 0 || 0 != (ofs & (rtapi_port)(sizeof(shm->magic)-1)) || ofs > (rtapi_port)(HAL_SIZE - sizeof(hal_port_shm_t))) return NULL; shm = SHMPTR(ofs); // The magic number must match and size be valid if (shm->magic != HAL_PORT_MAGIC_NUM || shm->size > HAL_PORT_SIZE_MAX) return NULL; // The ofset must not point beyond shared memory considering the size - if (ofs > (long)(HAL_SIZE - (sizeof(hal_port_shm_t) + shm->size))) + if (ofs > (rtapi_port)(HAL_SIZE - (sizeof(hal_port_shm_t) + shm->size))) return NULL; return shm; } -bool hal_port_read(const hal_port_t *port, char* dest, unsigned count) { +bool hal_port_read(const hal_port_t port, char* dest, unsigned count) { unsigned read, write, end_bytes_to_read, //number of bytes to read after read position and before end of buffer @@ -4592,7 +4149,7 @@ bool hal_port_read(const hal_port_t *port, char* dest, unsigned count) { } -bool hal_port_peek(const hal_port_t *port, char* dest, unsigned count) { +bool hal_port_peek(const hal_port_t port, char* dest, unsigned count) { unsigned read, write, end_bytes_to_read, //number of bytes to read after read position and before end of buffer @@ -4627,7 +4184,7 @@ bool hal_port_peek(const hal_port_t *port, char* dest, unsigned count) { } -bool hal_port_peek_commit(const hal_port_t *port, unsigned count) { +bool hal_port_peek_commit(const hal_port_t port, unsigned count) { unsigned read, write, end_bytes_to_read, //number of bytes to read after read position and before end of buffer @@ -4661,7 +4218,7 @@ bool hal_port_peek_commit(const hal_port_t *port, unsigned count) { } -bool hal_port_write(const hal_port_t *port, const char* src, unsigned count) { +bool hal_port_write(const hal_port_t port, const char* src, unsigned count) { unsigned read, write, bytes_avail, @@ -4717,7 +4274,7 @@ bool hal_port_write(const hal_port_t *port, const char* src, unsigned count) { } -unsigned hal_port_readable(const hal_port_t *port) { +unsigned hal_port_readable(const hal_port_t port) { hal_port_shm_t* port_shm = hal_port_to_shm(port); if(!port_shm) { rtapi_print_msg(RTAPI_MSG_ERR, "hal_port_readable: invalid port %p\n", port); @@ -4727,7 +4284,7 @@ unsigned hal_port_readable(const hal_port_t *port) { } -unsigned hal_port_writable(const hal_port_t *port) { +unsigned hal_port_writable(const hal_port_t port) { hal_port_shm_t* port_shm = hal_port_to_shm(port); if(!port_shm) { rtapi_print_msg(RTAPI_MSG_ERR, "hal_port_writable: invalid port %p\n", port); @@ -4737,7 +4294,7 @@ unsigned hal_port_writable(const hal_port_t *port) { } -unsigned hal_port_buffer_size(const hal_port_t *port) { +unsigned hal_port_buffer_size(const hal_port_t port) { hal_port_shm_t* port_shm = hal_port_to_shm(port); if(!port_shm) { rtapi_print_msg(RTAPI_MSG_ERR, "hal_port_buffer_size: invalid port %p\n", port); @@ -4747,7 +4304,7 @@ unsigned hal_port_buffer_size(const hal_port_t *port) { } -void hal_port_clear(const hal_port_t *port) { +void hal_port_clear(const hal_port_t port) { unsigned read,write; hal_port_shm_t* port_shm = hal_port_to_shm(port); if(!port_shm) { @@ -4760,15 +4317,15 @@ void hal_port_clear(const hal_port_t *port) { #ifdef ULAPI -void hal_port_wait_readable(hal_port_t** port, unsigned count, sig_atomic_t* stop) { - while((hal_port_readable(*port) < count) && (!stop || !*stop)) { +void hal_port_wait_readable(const hal_port_t port, unsigned count, sig_atomic_t *stop) { + while((hal_port_readable(port) < count) && (!stop || !*stop)) { rtapi_delay(10000000); } } -void hal_port_wait_writable(hal_port_t** port, unsigned count, sig_atomic_t* stop) { - while((hal_port_writable(*port) < count) && (!stop || !*stop)) { +void hal_port_wait_writable(const hal_port_t port, unsigned count, sig_atomic_t *stop) { + while((hal_port_writable(port) < count) && (!stop || !*stop)) { rtapi_delay(10000000); } } @@ -4802,13 +4359,11 @@ static char *hal_stream_type_string(int type, char *buf, size_t nbuf) { const char *cptr; switch(type) { - case HAL_BIT: cptr = "bit"; break; - case HAL_FLOAT: cptr = "float"; break; - case HAL_S32: cptr = "s32"; break; - case HAL_U32: cptr = "u32"; break; - case HAL_S64: cptr = "s64"; break; - case HAL_U64: cptr = "u64"; break; - case HAL_PORT: cptr = "port"; break; + case HAL_BOOL: cptr = "bool"; break; + case HAL_REAL: cptr = "real"; break; + case HAL_SINT: cptr = "sint"; break; + case HAL_UINT: cptr = "uint"; break; + case HAL_PORT: cptr = "port"; break; default: rtapi_snprintf(buf, nbuf, "UNK#%d", type); return buf; @@ -4829,12 +4384,12 @@ static int hal_stream_parse_types(hal_type_t type[HAL_STREAM_MAX_PINS], const ch for(n = 0; n < HAL_STREAM_MAX_PINS && *cfg != '\0'; n++) { switch (*cfg) { case 'r': case 'R': - case 'f': case 'F': type[n] = HAL_FLOAT; break; - case 'b': case 'B': type[n] = HAL_BIT; break; - case 'u': case 'U': type[n] = HAL_U32; break; - case 's': case 'S': type[n] = HAL_S32; break; - case 'l': case 'L': type[n] = HAL_S64; break; - case 'k': case 'K': type[n] = HAL_U64; break; + case 'f': case 'F': type[n] = HAL_REAL; break; + case 'b': case 'B': type[n] = HAL_BOOL; break; + case 's': case 'S': + case 'l': case 'L': type[n] = HAL_SINT; break; + case 'u': case 'U': + case 'k': case 'K': type[n] = HAL_UINT; break; default: rtapi_print_msg(RTAPI_MSG_ERR, "stream: ERROR: unknown type '%c', must be R (F), B, U, S, L or K\n", *cfg); return 0; @@ -5168,44 +4723,11 @@ EXPORT_SYMBOL(hal_pin_new_uint); EXPORT_SYMBOL(hal_pin_new_real); EXPORT_SYMBOL(hal_pin_new_port); -EXPORT_SYMBOL(hal_pin_bit_new); -EXPORT_SYMBOL(hal_pin_float_new); -EXPORT_SYMBOL(hal_pin_u32_new); -EXPORT_SYMBOL(hal_pin_s32_new); -EXPORT_SYMBOL(hal_pin_u64_new); -EXPORT_SYMBOL(hal_pin_s64_new); -EXPORT_SYMBOL(hal_pin_port_new); -EXPORT_SYMBOL(hal_pin_new); - -EXPORT_SYMBOL(hal_pin_bit_newf); -EXPORT_SYMBOL(hal_pin_float_newf); -EXPORT_SYMBOL(hal_pin_u32_newf); -EXPORT_SYMBOL(hal_pin_s32_newf); -EXPORT_SYMBOL(hal_pin_u64_newf); -EXPORT_SYMBOL(hal_pin_s64_newf); -EXPORT_SYMBOL(hal_pin_port_newf); - - EXPORT_SYMBOL(hal_signal_new); EXPORT_SYMBOL(hal_signal_delete); EXPORT_SYMBOL(hal_link); EXPORT_SYMBOL(hal_unlink); -EXPORT_SYMBOL(hal_param_bit_new); -EXPORT_SYMBOL(hal_param_float_new); -EXPORT_SYMBOL(hal_param_u32_new); -EXPORT_SYMBOL(hal_param_s32_new); -EXPORT_SYMBOL(hal_param_u64_new); -EXPORT_SYMBOL(hal_param_s64_new); -EXPORT_SYMBOL(hal_param_new); - -EXPORT_SYMBOL(hal_param_bit_newf); -EXPORT_SYMBOL(hal_param_float_newf); -EXPORT_SYMBOL(hal_param_u32_newf); -EXPORT_SYMBOL(hal_param_s32_newf); -EXPORT_SYMBOL(hal_param_u64_newf); -EXPORT_SYMBOL(hal_param_s64_newf); - EXPORT_SYMBOL(hal_param_new_bool); EXPORT_SYMBOL(hal_param_new_si32); EXPORT_SYMBOL(hal_param_new_ui32); @@ -5214,14 +4736,6 @@ EXPORT_SYMBOL(hal_param_new_uint); EXPORT_SYMBOL(hal_param_new_real); EXPORT_SYMBOL(hal_param_new_fake); -EXPORT_SYMBOL(hal_param_bit_set); -EXPORT_SYMBOL(hal_param_float_set); -EXPORT_SYMBOL(hal_param_u32_set); -EXPORT_SYMBOL(hal_param_s32_set); -EXPORT_SYMBOL(hal_param_u64_set); -EXPORT_SYMBOL(hal_param_s64_set); -EXPORT_SYMBOL(hal_param_set); - EXPORT_SYMBOL(hal_set_constructor); EXPORT_SYMBOL(hal_comp_invoke_make); diff --git a/src/hal/hal_lib_query.c b/src/hal/hal_lib_query.c index 09ec62cc827..8a6b57c7e6f 100644 --- a/src/hal/hal_lib_query.c +++ b/src/hal/hal_lib_query.c @@ -40,45 +40,20 @@ // //===================================================== -static int set_common(hal_type_t type, const hal_query_value_u *v, hal_refs_u u, bool setport, bool isparam) +static int set_common(hal_type_t type, const hal_query_value_u *v, hal_refs_u u, bool setport) { - // This is a special case because compatibility requires us to write to the - // smaller field when addressing parameters. An old-style param has a - // user-defined storage that may not be large enough for our new types and - // would overwrite other memory. - // FIXME: This code must be retired when we do the API break. - if(isparam) { - switch(type) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - case HAL_BOOL: ((hal_data_u *)u.b)->b = v->b; break; - case HAL_S32: ((hal_data_u *)u.s)->s = v->s; break; - case HAL_U32: ((hal_data_u *)u.u)->u = v->u; break; - case HAL_SINT: ((hal_data_u *)u.s)->ls = v->s; break; - case HAL_UINT: ((hal_data_u *)u.u)->lu = v->u; break; - case HAL_REAL: ((hal_data_u *)u.r)->f = v->r; break; -#pragma GCC diagnostic pop - default: - case HAL_PORT: return -EBADF; - } - return 0; - } switch(type) { case HAL_BOOL: hal_set_bool(u.b, v->b); break; - case HAL_S32: hal_set_si32(u.s, v->s); break; - case HAL_U32: hal_set_ui32(u.u, v->u); break; case HAL_SINT: hal_set_sint(u.s, v->s); break; case HAL_UINT: hal_set_uint(u.u, v->u); break; case HAL_REAL: hal_set_real(u.r, v->r); break; case HAL_PORT: { if(!setport) return -EBADF; - // FIXME: This needs to be changed when the old API is removed - rtapi_port port = hal_get_sint(u.s); - if(0 != port && hal_port_buffer_size((hal_port_t *)u.s) > 0) { + if(hal_port_buffer_size(u.p) > 0) { return -EISCONN; } - int rv = halpr_port_alloc(v->u, (hal_port_t *)u.s); + int rv = halpr_port_alloc(v->u, u.p); if(rv) return rv; } break; @@ -157,7 +132,7 @@ int hal_set_s(hal_query_t *q, hal_query_cb cb, void *arg) if(!rv) { // Success, data to write must be in the value union hal_refs_u u = (hal_refs_u)(hal_sint_t)SHMPTR(sig->data_ptr); - if((rv = set_common(sig->type, &q->sig.value, u, 1, 0)) < 0) { + if((rv = set_common(sig->type, &q->sig.value, u, 1)) < 0) { halpr_mutex_release(); if(-EBADF == rv) rtapi_print_msg(RTAPI_MSG_ERR, "hal_set_s: Signal '%s' has bad type %d\n", q->name, sig->type); @@ -204,7 +179,6 @@ int hal_set_p(hal_query_t *q, hal_query_cb cb, void *arg) hal_type_t t; hal_pin_t *pin = NULL; hal_refs_u u; - bool isparam; // If only parameters requested, don't look for pins if(HAL_QTYPE_PARAM != q->qtype) pin = halpr_find_pin_by_name(q->name); @@ -251,7 +225,6 @@ int hal_set_p(hal_query_t *q, hal_query_cb cb, void *arg) } // FIXME: This can be targeted to param's data when the old API is retired u = (hal_refs_u)(hal_sint_t)SHMPTR(param->data_ptr); - isparam = 1; } else { // We have a pin, copy the data, but we still can fail q->qtype = HAL_QTYPE_PIN; @@ -281,7 +254,6 @@ int hal_set_p(hal_query_t *q, hal_query_cb cb, void *arg) return -EACCES; } u = (hal_refs_u)(hal_sint_t)&pin->dummysig; - isparam = 0; } // Note: the callback is called while holding the mutex @@ -289,7 +261,7 @@ int hal_set_p(hal_query_t *q, hal_query_cb cb, void *arg) if(!rv) { // Success, data to write must be in the value union - if((rv = set_common(t, &q->pp.value, u, 0, isparam)) < 0) { + if((rv = set_common(t, &q->pp.value, u, 0)) < 0) { halpr_mutex_release(); if(-EBADF == rv) rtapi_print_msg(RTAPI_MSG_ERR, "hal_set_p: %s '%s' has bad type %d\n", pin ? "Pin" : "Param", q->name, t); @@ -305,8 +277,6 @@ static int get_common(hal_type_t type, hal_query_value_u *v, hal_refs_u u, bool { switch(type) { case HAL_BOOL: v->b = hal_get_bool(u.b); break; - case HAL_S32: v->s = hal_get_si32(u.s); break; - case HAL_U32: v->u = hal_get_ui32(u.u); break; case HAL_SINT: v->s = hal_get_sint(u.s); break; case HAL_UINT: v->u = hal_get_uint(u.u); break; case HAL_REAL: v->r = hal_get_real(u.r); break; @@ -314,8 +284,7 @@ static int get_common(hal_type_t type, hal_query_value_u *v, hal_refs_u u, bool if(!getport) { v->u = 0; } else { - // FIXME: This needs to be changed when the old API is removed - v->u = hal_port_buffer_size((hal_port_t *)u.s); + v->u = hal_port_buffer_size(u.p); } break; default: diff --git a/src/hal/hal_priv.h b/src/hal/hal_priv.h index 3e16f554614..a4f4dae9b7b 100644 --- a/src/hal/hal_priv.h +++ b/src/hal/hal_priv.h @@ -124,7 +124,7 @@ */ #define HAL_KEY 0x48414C32 /* key used to open HAL shared memory */ -#define HAL_VER 0x00000014 /* version code */ +#define HAL_VER 0x00000016 /* version code */ #define HAL_SIZE (2*256*4096) /* These pointers are set by hal_init() to point to the shmem block @@ -231,8 +231,8 @@ typedef union { inside a larger structure. */ typedef struct hal_list_t { - SHMFIELD(hal_list_t) next; /* next element in list */ - SHMFIELD(hal_list_t) prev; /* previous element in list */ + SHMFIELD(hal_list_t) next; // next element in list + SHMFIELD(hal_list_t) prev; // previous element in list } hal_list_t; /** HAL "oldname" data structure. @@ -240,8 +240,8 @@ typedef struct hal_list_t { store the original name. */ typedef struct hal_oldname_t { - SHMFIELD(hal_oldname_t) next_ptr; /* next struct (used for free list only) */ - char name[HAL_NAME_LEN + 1]; /* the original name */ + SHMFIELD(hal_oldname_t) next_ptr; // next struct (used for free list only) + char name[HAL_NAME_LEN + 1]; // the original name } hal_oldname_t; typedef struct hal_comp_t hal_comp_t; @@ -261,7 +261,7 @@ typedef struct hal_thread_t hal_thread_t; structure for all data in the HAL. */ typedef struct hal_data_t { - int version; /* version code for structs, etc */ + int version; // version code for structs, etc // WARNING: Do not touch these mutex lock fields. Only use the proper // functions halpr_mutex_acquire() and halpr_mutex_release(). See comment @@ -273,35 +273,31 @@ typedef struct hal_data_t { int locklvl; // Lock recursion level int locktid; // Lock owner thread ID - rtapi_s32 shmem_avail; /* amount of shmem left free */ - constructor pending_constructor; - /* pointer to the pending constructor function */ - char constructor_prefix[HAL_NAME_LEN+1]; - /* prefix of name for new instance */ - char constructor_arg[HAL_NAME_LEN+1]; - /* prefix of name for new instance */ - int shmem_bot; /* bottom of free shmem (first free byte) */ - int shmem_top; /* top of free shmem (1 past last free) */ - SHMFIELD(hal_comp_t) comp_list_ptr; /* root of linked list of components */ - SHMFIELD(hal_pin_t) pin_list_ptr; /* root of linked list of pins */ - SHMFIELD(hal_sig_t) sig_list_ptr; /* root of linked list of signals */ - SHMFIELD(hal_param_t) param_list_ptr; /* root of linked list of parameters */ - SHMFIELD(hal_funct_t) funct_list_ptr; /* root of linked list of functions */ - SHMFIELD(hal_thread_t) thread_list_ptr; /* root of linked list of threads */ - long base_period; /* timer period for realtime tasks */ - int threads_running; /* non-zero if threads are started */ - SHMFIELD(hal_oldname_t) oldname_free_ptr; /* list of free oldname structs */ - SHMFIELD(hal_comp_t) comp_free_ptr; /* list of free component structs */ - SHMFIELD(hal_pin_t) pin_free_ptr; /* list of free pin structs */ - SHMFIELD(hal_sig_t) sig_free_ptr; /* list of free signal structs */ - SHMFIELD(hal_param_t) param_free_ptr; /* list of free parameter structs */ - SHMFIELD(hal_funct_t) funct_free_ptr; /* list of free function structs */ - hal_list_t funct_entry_free; /* list of free funct entry structs */ - SHMFIELD(hal_thread_t) thread_free_ptr; /* list of free thread structs */ - int exact_base_period; /* if set, pretend that rtapi satisfied our - period request exactly */ - rtapi_realtime_type_t realtime_type; /* reflects the running realtime type */ - unsigned char lock; /* hal locking, can be one of the HAL_LOCK_* types */ + rtapi_s32 shmem_avail; // amount of shmem left free + constructor pending_constructor; // pointer to the pending constructor function + char constructor_prefix[HAL_NAME_LEN+1];// prefix of name for new instance + char constructor_arg[HAL_NAME_LEN+1]; // prefix of name for new instance + int shmem_bot; // bottom of free shmem (first free byte) + int shmem_top; // top of free shmem (1 past last free) + SHMFIELD(hal_comp_t) comp_list_ptr; // root of linked list of components + SHMFIELD(hal_pin_t) pin_list_ptr; // root of linked list of pins + SHMFIELD(hal_sig_t) sig_list_ptr; // root of linked list of signals + SHMFIELD(hal_param_t) param_list_ptr; // root of linked list of parameters + SHMFIELD(hal_funct_t) funct_list_ptr; // root of linked list of functions + SHMFIELD(hal_thread_t) thread_list_ptr; // root of linked list of threads + long base_period; // timer period for realtime tasks + int threads_running; // non-zero if threads are started + SHMFIELD(hal_oldname_t) oldname_free_ptr; // list of free oldname structs + SHMFIELD(hal_comp_t) comp_free_ptr; // list of free component structs + SHMFIELD(hal_pin_t) pin_free_ptr; // list of free pin structs + SHMFIELD(hal_sig_t) sig_free_ptr; // list of free signal structs + SHMFIELD(hal_param_t) param_free_ptr; // list of free parameter structs + SHMFIELD(hal_funct_t) funct_free_ptr; // list of free function structs + hal_list_t funct_entry_free; // list of free funct entry structs + SHMFIELD(hal_thread_t) thread_free_ptr; // list of free thread structs + int exact_base_period; // if set, pretend that rtapi satisfied our period request exactly + rtapi_realtime_type_t realtime_type; // reflects the running realtime type + unsigned char lock; // hal locking, can be one of the HAL_LOCK_* types } hal_data_t; // @@ -319,16 +315,16 @@ typedef hal_comp_type_t component_type_t; component calls hal_init(). */ struct hal_comp_t { - SHMFIELD(hal_comp_t) next_ptr; /* next component in the list */ - int comp_id; /* component ID (RTAPI module id) */ - int mem_id; /* RTAPI shmem ID used by this comp */ - component_type_t type; - int ready; /* nonzero if ready, 0 if not */ - int pid; /* PID of component (user components only) */ - void *shmem_base; /* base of shmem for this component */ - char name[HAL_NAME_LEN + 1]; /* component name */ + SHMFIELD(hal_comp_t) next_ptr; // next component in the list + int comp_id; // component ID (RTAPI module id) + int mem_id; // RTAPI shmem ID used by this comp + component_type_t type; // RT or non-RT (HAL_COMP_TYPE_*) + int ready; // nonzero if ready, 0 if not + int pid; // PID of component (user components only) + void *shmem_base; // base of shmem for this component + char name[HAL_NAME_LEN + 1]; // component name constructor make; - SHMFIELD(char) insmod_args; /* args passed to insmod when loaded */ + SHMFIELD(char) insmod_args; // args passed to insmod when loaded }; /** HAL 'pin' data structure. @@ -337,28 +333,28 @@ struct hal_comp_t { FIXME: Merge with hal_param_t */ struct hal_pin_t { - SHMFIELD(hal_pin_t) next_ptr; /* next pin in linked list */ - SHMFIELD(void*) data_ptr_addr; /* address of pin data pointer */ - SHMFIELD(hal_comp_t) owner_ptr; /* component that owns this pin */ - SHMFIELD(hal_oldname_t) oldname; /* old name if aliased, else zero */ - halpr_data_u dummysig; /* if unlinked, data_ptr points here */ - SHMFIELD(hal_sig_t) signal; /* signal to which pin is linked */ - hal_type_t type; /* data type */ - hal_pin_dir_t dir; /* pin direction */ - char name[HAL_NAME_LEN + 1]; /* pin name */ + SHMFIELD(hal_pin_t) next_ptr; // next pin in linked list + SHMFIELD(void*) data_ptr_addr; // address of pin data pointer + SHMFIELD(hal_comp_t) owner_ptr; // component that owns this pin + SHMFIELD(hal_oldname_t) oldname; // old name if aliased, else zero + halpr_data_u dummysig; // if unlinked, data_ptr points here + SHMFIELD(hal_sig_t) signal; // signal to which pin is linked + hal_type_t type; // data type + hal_pdir_t dir; // pin direction + char name[HAL_NAME_LEN + 1]; // pin name }; /** HAL 'signal' data structure. This structure contains information about a 'signal' object. */ struct hal_sig_t { - SHMFIELD(hal_sig_t) next_ptr; /* next signal in linked list */ - SHMFIELD(void*) data_ptr; /* offset of signal value */ - hal_type_t type; /* data type */ - int readers; /* number of input pins linked */ - int writers; /* number of output pins linked */ - int bidirs; /* number of I/O pins linked */ - char name[HAL_NAME_LEN + 1]; /* signal name */ + SHMFIELD(hal_sig_t) next_ptr; // next signal in linked list + SHMFIELD(void*) data_ptr; // offset of signal value + hal_type_t type; // data type + int readers; // number of input pins linked + int writers; // number of output pins linked + int bidirs; // number of I/O pins linked + char name[HAL_NAME_LEN + 1]; // signal name }; /** HAL 'parameter' data structure. @@ -367,15 +363,15 @@ struct hal_sig_t { FIXME: Merge with hal_pin_t */ struct hal_param_t { - SHMFIELD(hal_param_t) next_ptr; /* next parameter in linked list */ - SHMFIELD(void*) data_ptr; /* offset of parameter value */ - SHMFIELD(hal_comp_t) owner_ptr; /* component that owns this signal */ - SHMFIELD(hal_oldname_t) oldname; /* old name if aliased, else zero */ - halpr_data_u data; /* new API parameter storage is here, data_ptr points here too */ - SHMFIELD(void*) reserved; /* reserved to match hal_pin_t layout */ - hal_type_t type; /* data type */ - hal_param_dir_t dir; /* data direction */ - char name[HAL_NAME_LEN + 1]; /* parameter name */ + SHMFIELD(hal_param_t) next_ptr; // next parameter in linked list + SHMFIELD(void*) data_ptr; // offset of parameter value + SHMFIELD(hal_comp_t) owner_ptr; // component that owns this signal + SHMFIELD(hal_oldname_t) oldname; // old name if aliased, else zero + halpr_data_u data; // new API parameter storage is here, data_ptr points here too + SHMFIELD(void*) reserved; // reserved to match hal_pin_t layout + hal_type_t type; // data type + hal_pdir_t dir; // data direction + char name[HAL_NAME_LEN + 1]; // parameter name }; /** the HAL uses functions and threads to handle synchronization of @@ -395,48 +391,46 @@ struct hal_param_t { */ struct hal_funct_t { - SHMFIELD(hal_funct_t) next_ptr; /* next function in linked list */ - int uses_fp; /* floating point flag */ - SHMFIELD(hal_comp_t) owner_ptr; /* component that added this funct */ - int reentrant; /* non-zero if function is re-entrant */ - int users; /* number of threads using function */ - void *arg; /* argument for function */ - void (*funct) (void *, long); /* ptr to function code */ + SHMFIELD(hal_funct_t) next_ptr; // next function in linked list + SHMFIELD(hal_comp_t) owner_ptr; // component that added this funct + int reentrant; // non-zero if function is re-entrant + int users; // number of threads using function + void *arg; // argument for function + void (*funct) (void *, long); // ptr to function code // IMPORTANT: The pins and params are valid as seen from the context that // created them. For uspace that is rtapi_app and in the kernel it is the // kernel's module context. - hal_sint_t runtime; /* (pin) duration of last run, in CPU cycles */ - hal_sint_t maxtime; /* (param) duration of longest run, in CPU cycles */ - hal_bool_t maxtime_increased; /* (param) on last call, maxtime increased */ - char name[HAL_NAME_LEN + 1]; /* function name */ + hal_sint_t runtime; // (pin) duration of last run, in CPU cycles + hal_sint_t maxtime; // (param) duration of longest run, in CPU cycles + hal_bool_t maxtime_increased; // (param) on last call, maxtime increased + char name[HAL_NAME_LEN + 1]; // function name }; struct hal_funct_entry_t { - hal_list_t links; /* linked list data */ - void *arg; /* argument for function */ - void (*funct) (void *, long); /* ptr to function code */ - SHMFIELD(hal_funct_t) funct_ptr; /* pointer to function */ + hal_list_t links; // linked list data + void *arg; // argument for function + void (*funct) (void *, long); // ptr to function code + SHMFIELD(hal_funct_t) funct_ptr; // pointer to function }; -#define HAL_STACKSIZE 16384 /* realtime task stacksize */ +#define HAL_STACKSIZE 16384 // realtime task stacksize struct hal_thread_t { - SHMFIELD(hal_thread_t) next_ptr; /* next thread in linked list */ - int uses_fp; /* floating point flag */ - long int period; /* period of the thread, in nsec */ - int priority; /* priority of the thread */ - int task_id; /* ID of the task that runs this thread */ + SHMFIELD(hal_thread_t) next_ptr; // next thread in linked list + long int period; // period of the thread, in nsec + int priority; // priority of the thread + int task_id; // ID of the task that runs this thread // IMPORTANT: The pins and params are valid as seen from the context that // created them. For uspace that is rtapi_app and in the kernel it is the // kernel's module context. - hal_sint_t runtime; /* (pin) duration of last run, in ns */ - hal_sint_t maxtime; /* (param) duration of longest run, in ns */ - hal_sint_t threadbeat; /* (pin) visible monotonic loop beat counter */ - rtapi_sint beatcnt; /* Thread monotonic increasing loop beat counter (so we don't need to read/write volatile) */ - hal_list_t funct_list; /* list of functions to run */ - hal_list_t init_funct_list; /* list of init functions, run once before first cyclic cycle */ - int init_done; /* 0 = init pending, 1 = init cycle has executed */ - char name[HAL_NAME_LEN + 1]; /* thread name */ + hal_sint_t runtime; // (pin) duration of last run, in ns + hal_sint_t maxtime; // (param) duration of longest run, in ns + hal_sint_t threadbeat; // (pin) visible monotonic loop beat counter + rtapi_sint beatcnt; // Thread monotonic increasing loop beat counter (so we don't need to read/write volatile) + hal_list_t funct_list; // list of functions to run + hal_list_t init_funct_list; // list of init functions, run once before first cyclic cycle + int init_done; // 0 = init pending, 1 = init cycle has executed + char name[HAL_NAME_LEN + 1]; // thread name int comp_id; }; @@ -509,12 +503,9 @@ extern hal_comp_t *halpr_find_comp_by_id(int id); call, and return the next matching item. If no match is found, they return NULL. */ -extern hal_pin_t *halpr_find_pin_by_owner(hal_comp_t * owner, - hal_pin_t * start); -extern hal_param_t *halpr_find_param_by_owner(hal_comp_t * owner, - hal_param_t * start); -extern hal_funct_t *halpr_find_funct_by_owner(hal_comp_t * owner, - hal_funct_t * start); +extern hal_pin_t *halpr_find_pin_by_owner(hal_comp_t *owner, hal_pin_t *start); +extern hal_param_t *halpr_find_param_by_owner(hal_comp_t *owner, hal_param_t *start); +extern hal_funct_t *halpr_find_funct_by_owner(hal_comp_t *owner, hal_funct_t *start); /** 'find_pin_by_sig()' finds pin(s) that are linked to a specific signal. If 'start' is NULL, it starts at the beginning of the pin list, and @@ -530,7 +521,7 @@ extern hal_pin_t *halpr_find_pin_by_sig(hal_sig_t * sig, hal_pin_t * start); returned and the newly allocated hal_port_t is returned in the port argument and can be used with all other hal_port functions. */ -int halpr_port_alloc(unsigned size, hal_port_t *port); +int halpr_port_alloc(unsigned size, hal_port_t port); // Recursive HAL mutex (replaces old mutex) int halpr_mutex_acquire(void); diff --git a/src/hal/halmodule.cc b/src/hal/halmodule.cc index 3f581d7de4b..2b8a6afc784 100644 --- a/src/hal/halmodule.cc +++ b/src/hal/halmodule.cc @@ -374,18 +374,6 @@ static int pyhal_write_common(halitem *pin, PyObject *value) { hal_set_real(pin->u->r, tmp); break; } - case HAL_U32: { - rtapi_u32 tmp; - if(!from_python(value, &tmp)) return -1; - hal_set_ui32(pin->u->u, tmp); - break; - } - case HAL_S32: { - rtapi_s32 tmp; - if(!from_python(value, &tmp)) return -1; - hal_set_si32(pin->u->s, tmp); - break; - } case HAL_UINT: { rtapi_uint tmp; if(!from_python(value, &tmp)) return -1; @@ -408,14 +396,12 @@ static PyObject *pyhal_read_common(halitem *item) { if(!item) return NULL; switch(item->type) { case HAL_BOOL: return to_python(hal_get_bool(item->u->b)); - case HAL_U32: return to_python(hal_get_ui32(item->u->u)); - case HAL_S32: return to_python(hal_get_si32(item->u->s)); case HAL_UINT: return to_python(hal_get_uint(item->u->u)); case HAL_SINT: return to_python(hal_get_sint(item->u->s)); case HAL_REAL: return to_python(hal_get_real(item->u->r)); case HAL_PORT: if(item->is_pin) - return to_python(hal_port_buffer_size(reinterpret_cast(item->u->u))); + return to_python(hal_port_buffer_size(item->u->p)); else return to_python((unsigned)0); // HAL_PORT cannot be a parameter default: @@ -442,8 +428,6 @@ static bool is_valid_hal_type(hal_type_t t, bool allowport) { switch(t) { case HAL_BOOL: - case HAL_S32: - case HAL_U32: case HAL_SINT: case HAL_UINT: case HAL_REAL: @@ -455,7 +439,7 @@ static bool is_valid_hal_type(hal_type_t t, bool allowport) } } -static PyObject * pyhal_create_param(halobject *self, const char *name, hal_type_t type, hal_param_dir_t dir) { +static PyObject * pyhal_create_param(halobject *self, const char *name, hal_type_t type, hal_pdir_t dir) { int res; halitem param; param.is_pin = 0; @@ -475,8 +459,6 @@ static PyObject * pyhal_create_param(halobject *self, const char *name, hal_type switch(type) { case HAL_BOOL: res = hal_param_new_bool(self->hal_id, dir, ¶m.u->b, 0, "%s.%s", self->prefix, name); break; - case HAL_S32: res = hal_param_new_si32(self->hal_id, dir, ¶m.u->s, 0, "%s.%s", self->prefix, name); break; - case HAL_U32: res = hal_param_new_ui32(self->hal_id, dir, ¶m.u->u, 0, "%s.%s", self->prefix, name); break; case HAL_SINT: res = hal_param_new_sint(self->hal_id, dir, ¶m.u->s, 0, "%s.%s", self->prefix, name); break; case HAL_UINT: res = hal_param_new_uint(self->hal_id, dir, ¶m.u->u, 0, "%s.%s", self->prefix, name); break; case HAL_REAL: res = hal_param_new_real(self->hal_id, dir, ¶m.u->r, 0.0, "%s.%s", self->prefix, name); break; @@ -490,7 +472,7 @@ static PyObject * pyhal_create_param(halobject *self, const char *name, hal_type } -static PyObject * pyhal_create_pin(halobject *self, const char *name, hal_type_t type, hal_pin_dir_t dir) { +static PyObject * pyhal_create_pin(halobject *self, const char *name, hal_type_t type, hal_pdir_t dir) { char pin_name[HAL_NAME_LEN+1]; int res; halitem pin; @@ -518,13 +500,10 @@ static PyObject * pyhal_create_pin(halobject *self, const char *name, hal_type_t } switch(type) { case HAL_BOOL: res = hal_pin_new_bool(self->hal_id, dir, &pin.u->b, 0, "%s.%s", self->prefix, name); break; - case HAL_S32: res = hal_pin_new_si32(self->hal_id, dir, &pin.u->s, 0, "%s.%s", self->prefix, name); break; - case HAL_U32: res = hal_pin_new_ui32(self->hal_id, dir, &pin.u->u, 0, "%s.%s", self->prefix, name); break; case HAL_SINT: res = hal_pin_new_sint(self->hal_id, dir, &pin.u->s, 0, "%s.%s", self->prefix, name); break; case HAL_UINT: res = hal_pin_new_uint(self->hal_id, dir, &pin.u->u, 0, "%s.%s", self->prefix, name); break; case HAL_REAL: res = hal_pin_new_real(self->hal_id, dir, &pin.u->r, 0.0, "%s.%s", self->prefix, name); break; - // FIXME: This needs to change when we break the API. - case HAL_PORT: res = hal_pin_new_port(self->hal_id, dir, &pin.u->s, "%s.%s", self->prefix, name); break; + case HAL_PORT: res = hal_pin_new_port(self->hal_id, dir, &pin.u->p, "%s.%s", self->prefix, name); break; default: res = -EINVAL; break; } if(res) return pyhal_error(res); @@ -547,7 +526,7 @@ static PyObject *pyhal_new_param(PyObject *_self, PyObject *o) { PyErr_Format(PyExc_ValueError, "Duplicate parameter name '%s'", name); return NULL; } else { PyErr_Clear(); } - return pyhal_create_param(self, name, (hal_type_t)type, (hal_param_dir_t)dir); + return pyhal_create_param(self, name, (hal_type_t)type, (hal_pdir_t)dir); } @@ -564,7 +543,7 @@ static PyObject *pyhal_new_pin(PyObject *_self, PyObject *o) { PyErr_Format(PyExc_ValueError, "Duplicate pin name '%s'", name); return NULL; } else { PyErr_Clear(); } - return pyhal_create_pin(self, name, (hal_type_t)type, (hal_pin_dir_t)dir); + return pyhal_create_pin(self, name, (hal_type_t)type, (hal_pdir_t)dir); } enum what_type_e { @@ -820,12 +799,10 @@ PyTypeObject halobject_type = { static const char * pin_type2name(hal_type_t type) { switch (type) { - case HAL_BOOL: return "BIT"; - case HAL_S32: return "S32"; - case HAL_U32: return "U32"; - case HAL_SINT: return "S64"; - case HAL_UINT: return "U64"; - case HAL_REAL: return "FLOAT"; + case HAL_BOOL: return "BOOL"; + case HAL_SINT: return "SINT"; + case HAL_UINT: return "UINT"; + case HAL_REAL: return "REAL"; case HAL_PORT: return "PORT"; default: return "unknown"; } @@ -949,12 +926,12 @@ static PyObject *pyhal_port_write(PyObject *self, PyObject *o) Py_INCREF(Py_False); return Py_False; } - if(len > (Py_ssize_t)hal_port_writable((hal_port_t *)item->pin.u->u)) { + if(len > (Py_ssize_t)hal_port_writable(item->pin.u->p)) { Py_INCREF(Py_False); return Py_False; } - return PyBool_FromLong(hal_port_write((hal_port_t *)item->pin.u->u, cptr, (unsigned)len)); + return PyBool_FromLong(hal_port_write(item->pin.u->p, cptr, (unsigned)len)); } static PyObject *pyhal_port_read_peek(pyhalitem *item, PyObject *o, bool isread) @@ -978,7 +955,7 @@ static PyObject *pyhal_port_read_peek(pyhalitem *item, PyObject *o, bool isread) Py_INCREF(Py_False); return Py_False; } - if(l > (unsigned long)hal_port_readable((hal_port_t *)item->pin.u->u)) { + if(l > (unsigned long)hal_port_readable(item->pin.u->p)) { Py_INCREF(Py_False); return Py_False; } @@ -990,9 +967,9 @@ static PyObject *pyhal_port_read_peek(pyhalitem *item, PyObject *o, bool isread) } bool b; if(isread) - b = hal_port_read((hal_port_t *)item->pin.u->u, PyBytes_AsString(bts), (unsigned)l); + b = hal_port_read(item->pin.u->p, PyBytes_AsString(bts), (unsigned)l); else - b = hal_port_peek((hal_port_t *)item->pin.u->u, PyBytes_AsString(bts), (unsigned)l); + b = hal_port_peek(item->pin.u->p, PyBytes_AsString(bts), (unsigned)l); if(b) { Py_DECREF(bts); Py_INCREF(Py_False); @@ -1030,7 +1007,7 @@ static PyObject *pyhal_port_peek_commit(PyObject *self, PyObject *o) Py_INCREF(Py_False); return Py_False; } - return PyBool_FromLong(hal_port_peek_commit((hal_port_t *)item->pin.u->u, (unsigned)l)); + return PyBool_FromLong(hal_port_peek_commit(item->pin.u->p, (unsigned)l)); } static PyObject *pyhal_port_writable(PyObject *self, PyObject *) @@ -1042,7 +1019,7 @@ static PyObject *pyhal_port_writable(PyObject *self, PyObject *) PyErr_Format(PyExc_RuntimeError, "writable: %s: Pin not output", item->name); return NULL; } - return PyLong_FromUnsignedLong(hal_port_writable((hal_port_t *)item->pin.u->u)); + return PyLong_FromUnsignedLong(hal_port_writable(item->pin.u->p)); } static PyObject *pyhal_port_readable(PyObject *self, PyObject *) @@ -1054,7 +1031,7 @@ static PyObject *pyhal_port_readable(PyObject *self, PyObject *) PyErr_Format(PyExc_RuntimeError, "readable: %s: Pin not input", item->name); return NULL; } - return PyLong_FromUnsignedLong(hal_port_readable((hal_port_t *)item->pin.u->u)); + return PyLong_FromUnsignedLong(hal_port_readable(item->pin.u->p)); } static PyObject *pyhal_port_clear(PyObject *self, PyObject *) @@ -1062,7 +1039,7 @@ static PyObject *pyhal_port_clear(PyObject *self, PyObject *) pyhalitem *item = reinterpret_cast(self); if(!check_port(item, "clear")) return NULL; - hal_port_clear((hal_port_t *)item->pin.u->u); + hal_port_clear(item->pin.u->p); Py_INCREF(Py_None); return Py_None; } @@ -1072,7 +1049,7 @@ static PyObject *pyhal_port_size(PyObject *self, PyObject *) pyhalitem *item = reinterpret_cast(self); if(!check_port(item, "size")) return NULL; - return PyLong_FromUnsignedLong(hal_port_buffer_size((hal_port_t *)item->pin.u->u)); + return PyLong_FromUnsignedLong(hal_port_buffer_size(item->pin.u->p)); } static PyMethodDef halpin_methods[] = { @@ -1234,8 +1211,6 @@ PyObject *new_sig(PyObject * /*self*/, PyObject *args) { //printf("INFO HALMODULE -- make signal -> %s type %d\n",name,(hal_type_t) type); switch (type) { case HAL_BOOL: - case HAL_S32: - case HAL_U32: case HAL_SINT: case HAL_UINT: case HAL_REAL: @@ -1285,18 +1260,6 @@ static int set_common_cb(hal_query_t *q, void *arg) qvp->r = tmp; break; } - case HAL_S32: { - rtapi_s32 tmp; - if(!from_python(obj, &tmp)) return -EINVAL; - qvp->s = tmp; - break; - } - case HAL_U32: { - rtapi_u32 tmp; - if(!from_python(obj, &tmp)) return -EINVAL; - qvp->u = tmp; - break; - } case HAL_SINT: { rtapi_sint tmp; if(!from_python(obj, &tmp)) return -EINVAL; @@ -1358,8 +1321,6 @@ static PyObject *halref_to_object(hal_type_t type, const hal_query_value_u *v) { switch(type) { case HAL_BOOL: return to_python(v->b); - case HAL_U32: return to_python((rtapi_u32)v->u); - case HAL_S32: return to_python((rtapi_s32)v->s); case HAL_UINT: return to_python(v->u); case HAL_SINT: return to_python(v->s); case HAL_REAL: return to_python(v->r); @@ -1454,16 +1415,6 @@ static int pinparaminfo_add(const hal_query_t *q, PyObject *lst) str_n, q->name, str_v, PyBool_FromLong(hal_get_bool(q->pp.ref.b)), str_d, PyLong_FromLong(q->pp.dir), str_t, PyLong_FromLong(HAL_BOOL)); break; - case HAL_U32: - obj = Py_BuildValue("{s:s,s:k,s:N,s:N}", - str_n, q->name, str_v, hal_get_ui32(q->pp.ref.u), - str_d, PyLong_FromLong(q->pp.dir), str_t, PyLong_FromLong(HAL_U32)); - break; - case HAL_S32: - obj = Py_BuildValue("{s:s,s:l,s:N,s:N}", - str_n, q->name, str_v, hal_get_si32(q->pp.ref.s), - str_d, PyLong_FromLong(q->pp.dir), str_t, PyLong_FromLong(HAL_S32)); - break; case HAL_UINT: obj = Py_BuildValue("{s:s,s:K,s:N,s:N}", str_n, q->name, str_v, hal_get_uint(q->pp.ref.u), @@ -1548,16 +1499,6 @@ static int siginfo_add(const hal_query_t *q, PyObject *lst) str_n, q->name, str_v, PyBool_FromLong(hal_get_bool(q->sig.ref.b)), str_d, writer, str_t, PyLong_FromLong(HAL_BOOL)); break; - case HAL_U32: - obj = Py_BuildValue("{s:s,s:k,s:s,s:N}", - str_n, q->name, str_v, hal_get_ui32(q->sig.ref.u), - str_d, writer, str_t, PyLong_FromLong(HAL_U32)); - break; - case HAL_S32: - obj = Py_BuildValue("{s:s,s:l,s:s,s:N}", - str_n, q->name, str_v, hal_get_si32(q->sig.ref.s), - str_d, writer, str_t, PyLong_FromLong(HAL_S32)); - break; case HAL_UINT: obj = Py_BuildValue("{s:s,s:K,s:s,s:N}", str_n, q->name, str_v, hal_get_uint(q->sig.ref.u), @@ -1868,10 +1809,8 @@ static int pystream_init(PyObject *_self, PyObject *args, PyObject * /*kw*/) { switch(hal_stream_element_type(&self->stream, i)) { case HAL_BOOL: tbuf[i] = 'b'; break; case HAL_REAL: tbuf[i] = 'f'; break; - case HAL_S32: tbuf[i] = 's'; break; - case HAL_U32: tbuf[i] = 'u'; break; - case HAL_SINT: tbuf[i] = 'l'; break; - case HAL_UINT: tbuf[i] = 'k'; break; + case HAL_SINT: tbuf[i] = 's'; break; + case HAL_UINT: tbuf[i] = 'u'; break; default: tbuf[i] = '?'; break; } } @@ -2107,7 +2046,7 @@ static PyMethodDef module_methods[] = { {"get_msg_level", get_msg_level, METH_NOARGS, ".get_msg_level(): Get the RTAPI message level"}, {"new_sig", new_sig, METH_VARARGS, - ".new_sig('signal_name', type): Create a new signal with the specified name. 'type' is one of HAL_BIT, HAL_FLOAT, HAL_S32, or HAL_U32."}, + ".new_sig('signal_name', type): Create a new signal with the specified name. 'type' is one of HAL_BOOL, HAL_REAL, HAL_SINT, or HAL_UINT."}, {"connect", connect, METH_VARARGS, ".connect('pin_name', 'signal_name'): Connect the named pin to the named signal."}, {"disconnect", disconnect, METH_VARARGS, @@ -2148,8 +2087,8 @@ const char *module_doc = "Interface to LinuxCNC's hal\n" "import hal, time\n" "h = hal.component(\"component-name\")\n" "# create pins and parameters with calls to h.newpin and h.newparam\n" -"h.newpin(\"in\", hal.HAL_FLOAT, hal.HAL_IN)\n" -"h.newpin(\"out\", hal.HAL_FLOAT, hal.HAL_OUT)\n" +"h.newpin(\"in\", hal.Type.REAL, hal.Dir.IN)\n" +"h.newpin(\"out\", hal.Type.REAL, hal.Dir.OUT)\n" "h.ready() # mark the component as 'ready'\n" "\n" "try:\n" @@ -2193,15 +2132,11 @@ static const halenum_member_t halenum_type_members[] = { {"SINT", HAL_SINT}, {"UINT", HAL_UINT}, {"PORT", HAL_PORT}, - {"S32", HAL_S32}, - {"U32", HAL_U32}, {"HAL_BOOL", HAL_BOOL}, {"HAL_REAL", HAL_REAL}, {"HAL_SINT", HAL_SINT}, {"HAL_UINT", HAL_UINT}, {"HAL_PORT", HAL_PORT}, - {"HAL_S32", HAL_S32}, - {"HAL_U32", HAL_U32}, {} }; @@ -2321,12 +2256,6 @@ PyMODINIT_FUNC PyInit__hal(void) PyModule_AddIntConstant(m, "HAL_REAL", HAL_REAL); PyModule_AddIntConstant(m, "HAL_SINT", HAL_SINT); PyModule_AddIntConstant(m, "HAL_UINT", HAL_UINT); - PyModule_AddIntConstant(m, "HAL_BIT", HAL_BIT); - PyModule_AddIntConstant(m, "HAL_FLOAT", HAL_FLOAT); - PyModule_AddIntConstant(m, "HAL_S32", HAL_S32); - PyModule_AddIntConstant(m, "HAL_U32", HAL_U32); - PyModule_AddIntConstant(m, "HAL_S64", HAL_S64); - PyModule_AddIntConstant(m, "HAL_U64", HAL_U64); PyModule_AddIntConstant(m, "HAL_PORT", HAL_PORT); PyModule_AddIntConstant(m, "HAL_RO", HAL_RO); diff --git a/src/hal/halquery.cc b/src/hal/halquery.cc index 64fb36a92a1..d29f46aedfc 100644 --- a/src/hal/halquery.cc +++ b/src/hal/halquery.cc @@ -32,16 +32,12 @@ static py::object value_object(hal_type_t type, hal_refs_u u, bool ispin) { switch(type) { case HAL_BOOL: return py::bool_(hal_get_bool(u.b)); - case HAL_S32: return py::int_(hal_get_si32(u.s)); case HAL_SINT: return py::int_(hal_get_sint(u.s)); - case HAL_U32: return py::int_(hal_get_ui32(u.u)); case HAL_UINT: return py::int_(hal_get_uint(u.u)); case HAL_REAL: return py::float_(hal_get_real(u.r)); case HAL_PORT: - // FIXME - // Needs to change when we break the API and change hal_port_t if(ispin) - return py::int_(hal_port_buffer_size(reinterpret_cast(u.u))); + return py::int_(hal_port_buffer_size(u.p)); else return py::int_(0); // HAL_PORT cannot be a parameter default: return py::none(); diff --git a/src/hal/setps_util.c b/src/hal/setps_util.c index c3831376404..a5c44a5487c 100644 --- a/src/hal/setps_util.c +++ b/src/hal/setps_util.c @@ -63,12 +63,9 @@ int setps_common_cb(hal_query_t *q, void *arg) } } return -EINVAL; - case HAL_S32: case HAL_SINT: errno = 0; qvp->s = strtoll(value, &eptr, 0); - if(HAL_S32 == type && (qvp->s < RTAPI_INT32_MIN || qvp->s > RTAPI_INT32_MAX)) - return -ERANGE; if(0 != errno) return -errno; if(value == eptr || (('\0' != *eptr) && !isspace((unsigned char)*eptr))) @@ -80,12 +77,9 @@ int setps_common_cb(hal_query_t *q, void *arg) return -EBADF; } /* Fallthrough */ - case HAL_U32: case HAL_UINT: errno = 0; qvp->u = strtoull(value, &eptr, 0); - if((HAL_U32 == type || HAL_PORT == type) && qvp->u > RTAPI_UINT32_MAX) - return -ERANGE; if(0 != errno) return -errno; if(value == eptr || (('\0' != *eptr) && !isspace((unsigned char)*eptr))) diff --git a/src/hal/user_comps/hal_bridge.py b/src/hal/user_comps/hal_bridge.py index 1833ab7e7af..fe9201f371b 100644 --- a/src/hal/user_comps/hal_bridge.py +++ b/src/hal/user_comps/hal_bridge.py @@ -66,50 +66,50 @@ def init_hal(self): self.comp = h = hal.component("bridge") QHAL = Qhal(comp=self.comp, hal=hal) - self.jogRate = QHAL.newpin("jog-rate", hal.HAL_FLOAT, hal.HAL_OUT) - self.jogRateIn = QHAL.newpin("jog-rate-in", hal.HAL_FLOAT, hal.HAL_IN) + self.jogRate = QHAL.newpin("jog-rate", hal.Type.REAL, hal.Dir.OUT) + self.jogRateIn = QHAL.newpin("jog-rate-in", hal.Type.REAL, hal.Dir.IN) self.jogRateIn.pinValueChanged.connect(self.pinChanged) - self.jogRateAngular = QHAL.newpin("jog-rate-angular", hal.HAL_FLOAT, hal.HAL_OUT) - self.jogRateAngularIn = QHAL.newpin("jog-rate-angular-in", hal.HAL_FLOAT, hal.HAL_OUT) + self.jogRateAngular = QHAL.newpin("jog-rate-angular", hal.Type.REAL, hal.Dir.OUT) + self.jogRateAngularIn = QHAL.newpin("jog-rate-angular-in", hal.Type.REAL, hal.Dir.OUT) self.jogRateAngularIn.pinValueChanged.connect(self.pinChanged) - self.jogIncrement = QHAL.newpin("jog-increment", hal.HAL_FLOAT, hal.HAL_OUT) - self.jogIncrementAngular = QHAL.newpin("jog-increment-angular", hal.HAL_FLOAT, hal.HAL_OUT) - self.activeJoint = QHAL.newpin('joint-selected', hal.HAL_S32, hal.HAL_OUT) + self.jogIncrement = QHAL.newpin("jog-increment", hal.Type.REAL, hal.Dir.OUT) + self.jogIncrementAngular = QHAL.newpin("jog-increment-angular", hal.Type.REAL, hal.Dir.OUT) + self.activeJoint = QHAL.newpin('joint-selected', hal.Type.SINT, hal.Dir.OUT) for i in (self.INFO.AVAILABLE_AXES): let = i.lower() # input - self['axis{}Select'.format(let)] = QHAL.newpin('axis-%s-select'%let, hal.HAL_BIT, hal.HAL_IN) + self['axis{}Select'.format(let)] = QHAL.newpin('axis-%s-select'%let, hal.Type.BOOL, hal.Dir.IN) self['axis{}Select'.format(let)].pinValueChanged.connect(self.pinChanged) # output - self['Axis{}IsSelected'.format(let)] = QHAL.newpin('axis-%s-is-selected'%let, hal.HAL_BIT, hal.HAL_OUT) + self['Axis{}IsSelected'.format(let)] = QHAL.newpin('axis-%s-is-selected'%let, hal.Type.BOOL, hal.Dir.OUT) - self.cycle_start = QHAL.newpin('cycle-start-in',QHAL.HAL_BIT, QHAL.HAL_IN) + self.cycle_start = QHAL.newpin('cycle-start-in',QHAL.HAL_BOOL, QHAL.HAL_IN) self.cycle_start.pinValueChanged.connect(self.pinChanged) - self.cycle_pause = QHAL.newpin('cycle-pause-in',QHAL.HAL_BIT, QHAL.HAL_IN) + self.cycle_pause = QHAL.newpin('cycle-pause-in',QHAL.HAL_BOOL, QHAL.HAL_IN) self.cycle_pause.pinValueChanged.connect(self.pinChanged) - self.reload_display = QHAL.newpin('reload-display-in',QHAL.HAL_BIT, QHAL.HAL_IN) + self.reload_display = QHAL.newpin('reload-display-in',QHAL.HAL_BOOL, QHAL.HAL_IN) self.reload_display.pinValueChanged.connect(self.pinChanged) - self.shutdown = QHAL.newpin('shutdown-in',QHAL.HAL_BIT, QHAL.HAL_IN) + self.shutdown = QHAL.newpin('shutdown-in',QHAL.HAL_BOOL, QHAL.HAL_IN) self.shutdown.pinValueChanged.connect(self.pinChanged) - self.ok = QHAL.newpin('ok-in',QHAL.HAL_BIT, QHAL.HAL_IN) + self.ok = QHAL.newpin('ok-in',QHAL.HAL_BOOL, QHAL.HAL_IN) self.ok.pinValueChanged.connect(self.pinChanged) - self.cancel = QHAL.newpin('cancel-in',QHAL.HAL_BIT, QHAL.HAL_IN) + self.cancel = QHAL.newpin('cancel-in',QHAL.HAL_BOOL, QHAL.HAL_IN) self.cancel.pinValueChanged.connect(self.pinChanged) if not self.INFO.MDI_COMMAND_DICT is None: for i in self.INFO.MDI_COMMAND_DICT: LOG.debug('{} {}'.format(i,self.INFO.MDI_COMMAND_DICT.get(i))) - self[i] = QHAL.newpin('ini-mdi-cmd-{}'.format(i),QHAL.HAL_BIT, QHAL.HAL_IN) + self[i] = QHAL.newpin('ini-mdi-cmd-{}'.format(i),QHAL.HAL_BOOL, QHAL.HAL_IN) self[i].pinValueChanged.connect(self.runMacroChanged) if not self.INFO.MACRO_COMMAND_DICT is None: for name in self.INFO.MACRO_COMMAND_DICT: LOG.debug('{} {}'.format(name,self.INFO.MDI_COMMAND_DICT.get(name))) name = str(name) - self[name] = QHAL.newpin('ini-macro-cmd-{}'.format(name),QHAL.HAL_BIT, QHAL.HAL_IN) + self[name] = QHAL.newpin('ini-macro-cmd-{}'.format(name),QHAL.HAL_BOOL, QHAL.HAL_IN) self[name].pinValueChanged.connect(self.runMacroChanged) QHAL.setUpdateRate(100) diff --git a/src/hal/user_comps/hal_input.py b/src/hal/user_comps/hal_input.py index 87c90e716db..f786e2c3a23 100644 --- a/src/hal/user_comps/hal_input.py +++ b/src/hal/user_comps/hal_input.py @@ -82,18 +82,18 @@ def __init__(self, comp, idx, name, parts='KRAL'): for key in self.device.get_bits('EV_KEY'): key = tohalname(key) self.codes.add(key) - comp.newpin("%s.%s" % (idx, key), HAL_BIT, HAL_OUT) - comp.newpin("%s.%s-not" % (idx, key), HAL_BIT, HAL_OUT) + comp.newpin("%s.%s" % (idx, key), hal.Type.BOOL, hal.Dir.OUT) + comp.newpin("%s.%s-not" % (idx, key), hal.Type.BOOL, hal.Dir.OUT) self.set(key + "-not", 1) if 'R' in parts: for axis in self.device.get_bits('EV_REL'): name = tohalname(axis) self.codes.add(name) - comp.newpin("%s.%s-position" % (idx, name), HAL_FLOAT, HAL_OUT) - comp.newpin("%s.%s-counts" % (idx, name), HAL_S32, HAL_OUT) - comp.newpin("%s.%s-reset" % (idx, name), HAL_BIT, HAL_IN) - comp.newpin("%s.%s-scale" % (idx, name), HAL_FLOAT, HAL_IN) + comp.newpin("%s.%s-position" % (idx, name), hal.Type.REAL, hal.Dir.OUT) + comp.newpin("%s.%s-counts" % (idx, name), hal.Type.SINT, hal.Dir.OUT) + comp.newpin("%s.%s-reset" % (idx, name), hal.Type.BOOL, hal.Dir.IN) + comp.newpin("%s.%s-scale" % (idx, name), hal.Type.REAL, hal.Dir.IN) self.set(name + '-scale', 1.) self.rel_items.append(name) @@ -102,16 +102,16 @@ def __init__(self, comp, idx, name, parts='KRAL'): name = tohalname(axis) self.codes.add(name) absinfo = self.device.get_absinfo(axis) - comp.newpin("%s.%s-position" % (idx, name), HAL_FLOAT, HAL_OUT) - comp.newpin("%s.%s-counts" % (idx, name), HAL_S32, HAL_OUT) - comp.newpin("%s.%s-is-pos" % (idx, name), HAL_BIT, HAL_OUT) - comp.newpin("%s.%s-is-neg" % (idx, name), HAL_BIT, HAL_OUT) - comp.newpin("%s.%s-scale" % (idx, name), HAL_FLOAT, HAL_IN) - comp.newpin("%s.%s-offset" % (idx, name), HAL_FLOAT, HAL_IN) - comp.newpin("%s.%s-fuzz" % (idx, name), HAL_S32, HAL_IN) - comp.newpin("%s.%s-flat" % (idx, name), HAL_S32, HAL_IN) - comp.newparam("%s.%s-min" % (idx, name), HAL_S32, HAL_RO) - comp.newparam("%s.%s-max" % (idx, name), HAL_S32, HAL_RO) + comp.newpin("%s.%s-position" % (idx, name), hal.Type.REAL, hal.Dir.OUT) + comp.newpin("%s.%s-counts" % (idx, name), hal.Type.SINT, hal.Dir.OUT) + comp.newpin("%s.%s-is-pos" % (idx, name), hal.Type.BOOL, hal.Dir.OUT) + comp.newpin("%s.%s-is-neg" % (idx, name), hal.Type.BOOL, hal.Dir.OUT) + comp.newpin("%s.%s-scale" % (idx, name), hal.Type.REAL, hal.Dir.IN) + comp.newpin("%s.%s-offset" % (idx, name), hal.Type.REAL, hal.Dir.IN) + comp.newpin("%s.%s-fuzz" % (idx, name), hal.Type.SINT, hal.Dir.IN) + comp.newpin("%s.%s-flat" % (idx, name), hal.Type.SINT, hal.Dir.IN) + comp.newparam("%s.%s-min" % (idx, name), hal.Type.SINT, hal.Dir.RO) + comp.newparam("%s.%s-max" % (idx, name), hal.Type.SINT, hal.Dir.RO) center = (absinfo.minimum + absinfo.maximum)/2. halfrange = (absinfo.maximum - absinfo.minimum)/2. or 1 self.set(name + "-counts", absinfo.value) @@ -130,8 +130,8 @@ def __init__(self, comp, idx, name, parts='KRAL'): for led in self.device.get_bits('EV_LED'): name = tohalname(led) self.ledmap[name] = led - comp.newpin("%s.%s" % (idx, name), HAL_BIT, HAL_IN) - comp.newpin("%s.%s-invert" % (idx, name), HAL_BIT, HAL_IN) + comp.newpin("%s.%s" % (idx, name), hal.Type.BOOL, hal.Dir.IN) + comp.newpin("%s.%s-invert" % (idx, name), hal.Type.BOOL, hal.Dir.IN) self.last[name] = 0 self.device.write_event('EV_LED', led, 0) @@ -203,7 +203,7 @@ def update(self): self.set(r + "-position", self.get(r + "-counts") / scale) for k, v in list(self.last.items()): - # Note: this is OK because the hal module always returns True or False for HAL_BIT values + # Note: this is OK because the hal module always returns True or False for hal.Type.BOOL values u = self.comp["%s.%s" % ( self.idx, k)] != self.comp["%s.%s-invert" % (self.idx, k)] if u != self.last[k]: diff --git a/src/hal/user_comps/mitsub_vfd.py b/src/hal/user_comps/mitsub_vfd.py index 8d0d6914686..dff04f6718d 100644 --- a/src/hal/user_comps/mitsub_vfd.py +++ b/src/hal/user_comps/mitsub_vfd.py @@ -69,34 +69,34 @@ def __init__(self,vfd_names=[['mitsub_vfd','00']],baudrate=9600,port='/dev/ttyUS for index,name in enumerate(self.comp_names): #print index,' NAME:',name[0],' SLAVE:',name[1] c = hal.component(name[0]) - c.newpin("fwd", hal.HAL_BIT, hal.HAL_IN) - c.newpin("run", hal.HAL_BIT, hal.HAL_IN) - c.newpin("up-to-speed", hal.HAL_BIT, hal.HAL_OUT) - c.newpin("alarm", hal.HAL_BIT, hal.HAL_OUT) - c.newpin("debug", hal.HAL_BIT, hal.HAL_IN) - c.newpin("monitor", hal.HAL_BIT, hal.HAL_IN) - c.newpin("motor-cmd", hal.HAL_FLOAT, hal.HAL_IN) - c.newpin("motor-fb", hal.HAL_FLOAT, hal.HAL_OUT) - c.newpin("motor-amps", hal.HAL_FLOAT, hal.HAL_OUT) - c.newpin("motor-volts", hal.HAL_FLOAT, hal.HAL_OUT) - c.newpin("motor-power", hal.HAL_FLOAT, hal.HAL_OUT) - c.newpin("motor-user", hal.HAL_FLOAT, hal.HAL_OUT) - c.newpin("scale-cmd", hal.HAL_FLOAT, hal.HAL_IN) - c.newpin("scale-fb", hal.HAL_FLOAT, hal.HAL_IN) - c.newpin("scale-amps", hal.HAL_FLOAT, hal.HAL_IN) - c.newpin("scale-volts", hal.HAL_FLOAT, hal.HAL_IN) - c.newpin("scale-power", hal.HAL_FLOAT, hal.HAL_IN) - c.newpin("scale-user", hal.HAL_FLOAT, hal.HAL_IN) - c.newpin("estop", hal.HAL_BIT, hal.HAL_IN) - c.newpin("reset-on-estop", hal.HAL_BIT, hal.HAL_IN) - c.newpin("stat-bit-0", hal.HAL_BIT, hal.HAL_OUT) - c.newpin("stat-bit-1", hal.HAL_BIT, hal.HAL_OUT) - c.newpin("stat-bit-2", hal.HAL_BIT, hal.HAL_OUT) - c.newpin("stat-bit-3", hal.HAL_BIT, hal.HAL_OUT) - c.newpin("stat-bit-4", hal.HAL_BIT, hal.HAL_OUT) - c.newpin("stat-bit-5", hal.HAL_BIT, hal.HAL_OUT) - c.newpin("stat-bit-6", hal.HAL_BIT, hal.HAL_OUT) - c.newpin("stat-bit-7", hal.HAL_BIT, hal.HAL_OUT) + c.newpin("fwd", hal.Type.BOOL, hal.Dir.IN) + c.newpin("run", hal.Type.BOOL, hal.Dir.IN) + c.newpin("up-to-speed", hal.Type.BOOL, hal.Dir.OUT) + c.newpin("alarm", hal.Type.BOOL, hal.Dir.OUT) + c.newpin("debug", hal.Type.BOOL, hal.Dir.IN) + c.newpin("monitor", hal.Type.BOOL, hal.Dir.IN) + c.newpin("motor-cmd", hal.Type.REAL, hal.Dir.IN) + c.newpin("motor-fb", hal.Type.REAL, hal.Dir.OUT) + c.newpin("motor-amps", hal.Type.REAL, hal.Dir.OUT) + c.newpin("motor-volts", hal.Type.REAL, hal.Dir.OUT) + c.newpin("motor-power", hal.Type.REAL, hal.Dir.OUT) + c.newpin("motor-user", hal.Type.REAL, hal.Dir.OUT) + c.newpin("scale-cmd", hal.Type.REAL, hal.Dir.IN) + c.newpin("scale-fb", hal.Type.REAL, hal.Dir.IN) + c.newpin("scale-amps", hal.Type.REAL, hal.Dir.IN) + c.newpin("scale-volts", hal.Type.REAL, hal.Dir.IN) + c.newpin("scale-power", hal.Type.REAL, hal.Dir.IN) + c.newpin("scale-user", hal.Type.REAL, hal.Dir.IN) + c.newpin("estop", hal.Type.BOOL, hal.Dir.IN) + c.newpin("reset-on-estop", hal.Type.BOOL, hal.Dir.IN) + c.newpin("stat-bit-0", hal.Type.BOOL, hal.Dir.OUT) + c.newpin("stat-bit-1", hal.Type.BOOL, hal.Dir.OUT) + c.newpin("stat-bit-2", hal.Type.BOOL, hal.Dir.OUT) + c.newpin("stat-bit-3", hal.Type.BOOL, hal.Dir.OUT) + c.newpin("stat-bit-4", hal.Type.BOOL, hal.Dir.OUT) + c.newpin("stat-bit-5", hal.Type.BOOL, hal.Dir.OUT) + c.newpin("stat-bit-6", hal.Type.BOOL, hal.Dir.OUT) + c.newpin("stat-bit-7", hal.Type.BOOL, hal.Dir.OUT) # set reasonable defaults c['scale-cmd'] = 1 c['scale-fb'] = 1 diff --git a/src/hal/user_comps/mqtt-publisher.py b/src/hal/user_comps/mqtt-publisher.py index 847137dc30b..0a7c1ce60af 100755 --- a/src/hal/user_comps/mqtt-publisher.py +++ b/src/hal/user_comps/mqtt-publisher.py @@ -73,11 +73,11 @@ def create_pins(self, keys): self.lcncstat.poll() self.hal = hal.component('mqtt-publisher') - self.hal.newpin('enable', hal.HAL_BIT, hal.HAL_IN) + self.hal.newpin('enable', hal.Type.BOOL, hal.Dir.IN) self.hal['enable'] = True - self.hal.newpin('period', hal.HAL_U32, hal.HAL_IN) + self.hal.newpin('period', hal.Type.UINT, hal.Dir.IN) self.hal['period'] = 10 - self.hal.newpin('lastpublish', hal.HAL_U32, hal.HAL_OUT) + self.hal.newpin('lastpublish', hal.Type.UINT, hal.Dir.OUT) self.hal['lastpublish'] = 0 self.hal.ready() diff --git a/src/hal/user_comps/mtconnect-agent.py b/src/hal/user_comps/mtconnect-agent.py index c4a5d87047e..d64e2d1f418 100755 --- a/src/hal/user_comps/mtconnect-agent.py +++ b/src/hal/user_comps/mtconnect-agent.py @@ -94,8 +94,8 @@ def make_hal_pins(): comp = hal.component("mtconnect-agent") comp.newpin("enable", hal.Type.BOOL, hal.Dir.IN) comp["enable"] = True - comp.newpin("sample-hz", hal.Type.U32, hal.Dir.IN) - comp.newpin("heartbeat", hal.Type.U32, hal.Dir.OUT) + comp.newpin("sample-hz", hal.Type.UINT, hal.Dir.IN) + comp.newpin("heartbeat", hal.Type.UINT, hal.Dir.OUT) # Status outputs (linkable in the HAL file): # active - agent is polling and serving # connected - MQTT broker link is up (stays low without MQTT; HTTP/SHDR diff --git a/src/hal/user_comps/pi500_vfd/pi500_vfd.comp b/src/hal/user_comps/pi500_vfd/pi500_vfd.comp index 792852b1ab4..92cc57bdf52 100644 --- a/src/hal/user_comps/pi500_vfd/pi500_vfd.comp +++ b/src/hal/user_comps/pi500_vfd/pi500_vfd.comp @@ -1,5 +1,5 @@ component pi500_vfd "Powtran PI500 Modbus driver"; -param rw ui32 mbslaveaddr "Modbus slave address"; +param rw uint mbslaveaddr "Modbus slave address"; pin in real commanded_frequency "Frequency of vfd"; pin in bool run "run the vfd"; pin in bool enable "1 to enable the vfd. 0 will remote trip the vfd, thereby disabling it."; @@ -134,7 +134,7 @@ bool pi500_getStatus(modbus_t* ctx, pi500_status* status) void print_modbus_error(struct __comp_state *__comp_inst, const char* msg) { fprintf(stderr, - "Error: pi500_vfd slave(%u): %s - Modbus error (%d) - %s\n", + "Error: pi500_vfd slave(%lu): %s - Modbus error (%d) - %s\n", mbslaveaddr, msg, errno, diff --git a/src/hal/user_comps/pmx485.py b/src/hal/user_comps/pmx485.py index 6c7796f0be7..15e1d2a512d 100644 --- a/src/hal/user_comps/pmx485.py +++ b/src/hal/user_comps/pmx485.py @@ -46,20 +46,20 @@ # create pmx485 component try: pmx485 = hal.component('pmx485') - pmx485.newpin('mode_set', hal.HAL_FLOAT, hal.HAL_IN) #set cutting mode - pmx485.newpin('current_set', hal.HAL_FLOAT, hal.HAL_IN) #set cutting current - pmx485.newpin('pressure_set', hal.HAL_FLOAT, hal.HAL_IN) #set gas pressure - pmx485.newpin('enable', hal.HAL_BIT, hal.HAL_IN) #enabler - pmx485.newpin('mode', hal.HAL_FLOAT, hal.HAL_OUT) #cut mode feedback - pmx485.newpin('current', hal.HAL_FLOAT, hal.HAL_OUT) #cutting current feedback - pmx485.newpin('pressure', hal.HAL_FLOAT, hal.HAL_OUT) #gas pressure feedback - pmx485.newpin('fault', hal.HAL_FLOAT, hal.HAL_OUT) #fault code - pmx485.newpin('status', hal.HAL_BIT, hal.HAL_OUT) #connection status out - pmx485.newpin('current_min', hal.HAL_FLOAT, hal.HAL_OUT) #minimum allowed current - pmx485.newpin('current_max', hal.HAL_FLOAT, hal.HAL_OUT) #maximum allowed current - pmx485.newpin('pressure_min', hal.HAL_FLOAT, hal.HAL_OUT) #minimum allowed gas pressure - pmx485.newpin('pressure_max', hal.HAL_FLOAT, hal.HAL_OUT) #maximum allowed gas pressure - pmx485.newpin('arcTime', hal.HAL_FLOAT, hal.HAL_OUT) #arc on time feedback + pmx485.newpin('mode_set', hal.Type.REAL, hal.Dir.IN) #set cutting mode + pmx485.newpin('current_set', hal.Type.REAL, hal.Dir.IN) #set cutting current + pmx485.newpin('pressure_set', hal.Type.REAL, hal.Dir.IN) #set gas pressure + pmx485.newpin('enable', hal.Type.BOOL, hal.Dir.IN) #enabler + pmx485.newpin('mode', hal.Type.REAL, hal.Dir.OUT) #cut mode feedback + pmx485.newpin('current', hal.Type.REAL, hal.Dir.OUT) #cutting current feedback + pmx485.newpin('pressure', hal.Type.REAL, hal.Dir.OUT) #gas pressure feedback + pmx485.newpin('fault', hal.Type.REAL, hal.Dir.OUT) #fault code + pmx485.newpin('status', hal.Type.BOOL, hal.Dir.OUT) #connection status out + pmx485.newpin('current_min', hal.Type.REAL, hal.Dir.OUT) #minimum allowed current + pmx485.newpin('current_max', hal.Type.REAL, hal.Dir.OUT) #maximum allowed current + pmx485.newpin('pressure_min', hal.Type.REAL, hal.Dir.OUT) #minimum allowed gas pressure + pmx485.newpin('pressure_max', hal.Type.REAL, hal.Dir.OUT) #maximum allowed gas pressure + pmx485.newpin('arcTime', hal.Type.REAL, hal.Dir.OUT) #arc on time feedback pmx485.ready() except: print('\nERROR: pmx485 component could not be initialized\n') diff --git a/src/hal/user_comps/scorbot-er-3.py b/src/hal/user_comps/scorbot-er-3.py index 77c420d916d..2206223f798 100755 --- a/src/hal/user_comps/scorbot-er-3.py +++ b/src/hal/user_comps/scorbot-er-3.py @@ -76,10 +76,10 @@ def serial_read(num_bytes): old_counts = [None] * 8 old_motor_max_vel = [None] * 8 for joint in range(0, 8): - h.newpin('joint%d.limit-sw' % joint, hal.HAL_BIT, hal.HAL_OUT) - h.newpin('joint%d.motor-pos-cmd' % joint, hal.HAL_FLOAT, hal.HAL_IN) - h.newpin('joint%d.scale' % joint, hal.HAL_FLOAT, hal.HAL_IN) - h.newpin('joint%d.motor-max-vel' % joint, hal.HAL_S32, hal.HAL_IN) + h.newpin('joint%d.limit-sw' % joint, hal.Type.BOOL, hal.Dir.OUT) + h.newpin('joint%d.motor-pos-cmd' % joint, hal.Type.REAL, hal.Dir.IN) + h.newpin('joint%d.scale' % joint, hal.Type.REAL, hal.Dir.IN) + h.newpin('joint%d.motor-max-vel' % joint, hal.Type.SINT, hal.Dir.IN) h['joint%d.motor-pos-cmd' % joint] = 0.0 old_motor_pos_cmd[joint] = 0.0 diff --git a/src/hal/user_comps/sim-torch.py b/src/hal/user_comps/sim-torch.py index 9b45326917e..de150d33c71 100644 --- a/src/hal/user_comps/sim-torch.py +++ b/src/hal/user_comps/sim-torch.py @@ -29,19 +29,19 @@ h = hal.component('sim-torch') # create the hal pins h.setprefix('sim-torch') -h.newpin('cut-noise-in', hal.HAL_FLOAT, hal.HAL_IN) -h.newpin('cycles-in', hal.HAL_S32, hal.HAL_IN) -h.newpin('on-delay-in', hal.HAL_S32, hal.HAL_IN) -h.newpin('offset-in', hal.HAL_FLOAT, hal.HAL_IN) -h.newpin('overshoot-in', hal.HAL_S32, hal.HAL_IN) -h.newpin('ramp-noise-in', hal.HAL_FLOAT, hal.HAL_IN) -h.newpin('ramp-up-in', hal.HAL_S32, hal.HAL_IN) -h.newpin('start', hal.HAL_BIT, hal.HAL_IN) -h.newpin('voltage-in', hal.HAL_FLOAT, hal.HAL_IN) -h.newpin('close', hal.HAL_BIT, hal.HAL_IN) -h.newpin('voltage-out', hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin('void', hal.HAL_BIT, hal.HAL_IN) -h.newpin('void_ramp', hal.HAL_S32, hal.HAL_IN) +h.newpin('cut-noise-in', hal.Type.REAL, hal.Dir.IN) +h.newpin('cycles-in', hal.Type.SINT, hal.Dir.IN) +h.newpin('on-delay-in', hal.Type.SINT, hal.Dir.IN) +h.newpin('offset-in', hal.Type.REAL, hal.Dir.IN) +h.newpin('overshoot-in', hal.Type.SINT, hal.Dir.IN) +h.newpin('ramp-noise-in', hal.Type.REAL, hal.Dir.IN) +h.newpin('ramp-up-in', hal.Type.SINT, hal.Dir.IN) +h.newpin('start', hal.Type.BOOL, hal.Dir.IN) +h.newpin('voltage-in', hal.Type.REAL, hal.Dir.IN) +h.newpin('close', hal.Type.BOOL, hal.Dir.IN) +h.newpin('voltage-out', hal.Type.REAL, hal.Dir.OUT) +h.newpin('void', hal.Type.BOOL, hal.Dir.IN) +h.newpin('void_ramp', hal.Type.SINT, hal.Dir.IN) # setdefaults for input pins h['cut-noise-in'] = 0.75 h['cycles-in'] = 200 #"the number of cycles that the arc voltage overshoots the cut voltage (cycles)" diff --git a/src/hal/user_comps/vismach/5axisgui.py b/src/hal/user_comps/vismach/5axisgui.py index 0366112c4f7..d5fe64fef4e 100755 --- a/src/hal/user_comps/vismach/5axisgui.py +++ b/src/hal/user_comps/vismach/5axisgui.py @@ -79,14 +79,14 @@ def coords(self): return -self.comp.tool_length, r, 0, r c = hal.component("5axisgui") -c.newpin("jx", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jy", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jz", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jb", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jc", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool_length", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool_diam", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("pivot_len", hal.HAL_FLOAT, hal.HAL_OUT) +c.newpin("jx", hal.Type.REAL, hal.Dir.IN) +c.newpin("jy", hal.Type.REAL, hal.Dir.IN) +c.newpin("jz", hal.Type.REAL, hal.Dir.IN) +c.newpin("jb", hal.Type.REAL, hal.Dir.IN) +c.newpin("jc", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool_length", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool_diam", hal.Type.REAL, hal.Dir.IN) +c.newpin("pivot_len", hal.Type.REAL, hal.Dir.OUT) c["pivot_len"] = pivot_len c.ready() diff --git a/src/hal/user_comps/vismach/hbmgui.py b/src/hal/user_comps/vismach/hbmgui.py index 55f423c1136..0a3dcaf580f 100755 --- a/src/hal/user_comps/vismach/hbmgui.py +++ b/src/hal/user_comps/vismach/hbmgui.py @@ -74,13 +74,13 @@ def coords(self): c = hal.component("hbmgui") # HAL pins -c.newpin("table", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("saddle", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("head", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("quill", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("table", hal.Type.REAL, hal.Dir.IN) +c.newpin("saddle", hal.Type.REAL, hal.Dir.IN) +c.newpin("head", hal.Type.REAL, hal.Dir.IN) +c.newpin("quill", hal.Type.REAL, hal.Dir.IN) -c.newpin("tool-length", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool-radius", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tool-length", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool-radius", hal.Type.REAL, hal.Dir.IN) c.ready() tool_radius=0.5 diff --git a/src/hal/user_comps/vismach/hexagui.py b/src/hal/user_comps/vismach/hexagui.py index 36429fa899a..cba5d8b015a 100755 --- a/src/hal/user_comps/vismach/hexagui.py +++ b/src/hal/user_comps/vismach/hexagui.py @@ -52,20 +52,20 @@ def popupmsg(): #if(randomize): compname += str(random.randrange(0,10000)) c = hal.component(compname) #declare hal pins here -c.newpin("joint.0", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint.1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint.2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint.3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint.4", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint.5", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint.0", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint.1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint.2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint.3", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint.4", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint.5", hal.Type.REAL, hal.Dir.IN) #get the tool tip position in cartesian coordinates from emc #so we dont have to do kinematics -c.newpin("axis.x", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis.y", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis.z", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis.a", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis.b", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("axis.c", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("axis.x", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis.y", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis.z", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis.a", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis.b", hal.Type.REAL, hal.Dir.IN) +c.newpin("axis.c", hal.Type.REAL, hal.Dir.IN) c.ready() diff --git a/src/hal/user_comps/vismach/lineardelta.py b/src/hal/user_comps/vismach/lineardelta.py index b1b7377903c..2b0638258f0 100644 --- a/src/hal/user_comps/vismach/lineardelta.py +++ b/src/hal/user_comps/vismach/lineardelta.py @@ -59,12 +59,12 @@ def popupmsg(): for setting in sys.argv[1:]: exec(setting) c = hal.component("lineardelta") -c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("R", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("L", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint0", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint3", hal.Type.REAL, hal.Dir.IN) +c.newpin("R", hal.Type.REAL, hal.Dir.IN) +c.newpin("L", hal.Type.REAL, hal.Dir.IN) c['R'], c['L'] = lineardeltakins.get_geometry() c.ready() diff --git a/src/hal/user_comps/vismach/maho600gui.py b/src/hal/user_comps/vismach/maho600gui.py index 14bc2ab1842..62835735e7a 100755 --- a/src/hal/user_comps/vismach/maho600gui.py +++ b/src/hal/user_comps/vismach/maho600gui.py @@ -69,19 +69,19 @@ def coords(self): c = hal.component("maho600gui") # table -c.newpin("table", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("table", hal.Type.REAL, hal.Dir.IN) # full width ways that table rides one # this assembly moves up and down for Y -c.newpin("tableway", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tableway", hal.Type.REAL, hal.Dir.IN) # head vertical slide -c.newpin("head", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("head", hal.Type.REAL, hal.Dir.IN) # head tilt -c.newpin("arotate", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("arotate", hal.Type.REAL, hal.Dir.IN) # rotary table -c.newpin("brotate", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("brotate", hal.Type.REAL, hal.Dir.IN) -c.newpin("tool-length", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool-radius", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tool-length", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool-radius", hal.Type.REAL, hal.Dir.IN) c.ready() pivot_len=100 diff --git a/src/hal/user_comps/vismach/max5gui.py b/src/hal/user_comps/vismach/max5gui.py index f020299cc66..46e6d4c7a35 100755 --- a/src/hal/user_comps/vismach/max5gui.py +++ b/src/hal/user_comps/vismach/max5gui.py @@ -69,18 +69,18 @@ def coords(self): c = hal.component("max5gui") # table -c.newpin("table", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("table", hal.Type.REAL, hal.Dir.IN) # saddle -c.newpin("saddle", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("saddle", hal.Type.REAL, hal.Dir.IN) # head vertical slide -c.newpin("head", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("head", hal.Type.REAL, hal.Dir.IN) # head tilt -c.newpin("tilt", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tilt", hal.Type.REAL, hal.Dir.IN) # rotary table -c.newpin("rotate", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotate", hal.Type.REAL, hal.Dir.IN) -c.newpin("tool-length", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool-radius", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tool-length", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool-radius", hal.Type.REAL, hal.Dir.IN) c.ready() pivot_len=100 diff --git a/src/hal/user_comps/vismach/melfagui.py b/src/hal/user_comps/vismach/melfagui.py index 479f1c6cdc2..058bd545fa0 100755 --- a/src/hal/user_comps/vismach/melfagui.py +++ b/src/hal/user_comps/vismach/melfagui.py @@ -41,15 +41,15 @@ def popupmsg(): import hal c = hal.component("melfagui") -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint6", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("lnkdx", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("lnkdz", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("grip", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint3", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint4", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint5", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint6", hal.Type.REAL, hal.Dir.IN) +c.newpin("lnkdx", hal.Type.REAL, hal.Dir.IN) +c.newpin("lnkdz", hal.Type.REAL, hal.Dir.IN) +c.newpin("grip", hal.Type.REAL, hal.Dir.IN) c.ready() diff --git a/src/hal/user_comps/vismach/millturngui.py b/src/hal/user_comps/vismach/millturngui.py index fa822699cde..a376035a1f6 100755 --- a/src/hal/user_comps/vismach/millturngui.py +++ b/src/hal/user_comps/vismach/millturngui.py @@ -57,18 +57,18 @@ def popupmsg(): # in this file, and uncomment last line in HAL file. # add joints. Mill has 3. c = hal.component("millturngui") -c.newpin("jointX", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jointY", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jointZ", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("jointA", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("jointX", hal.Type.REAL, hal.Dir.IN) +c.newpin("jointY", hal.Type.REAL, hal.Dir.IN) +c.newpin("jointZ", hal.Type.REAL, hal.Dir.IN) +c.newpin("jointA", hal.Type.REAL, hal.Dir.IN) # kinematics pins -c.newpin("millkins", hal.HAL_BIT, hal.HAL_IN) +c.newpin("millkins", hal.Type.BOOL, hal.Dir.IN) # tool length and diameter pins? -c.newpin("toollength", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tooldiameter", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool-x-offset", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("toollength", hal.Type.REAL, hal.Dir.IN) +c.newpin("tooldiameter", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool-x-offset", hal.Type.REAL, hal.Dir.IN) # tells loadusr pins is ready c.ready() diff --git a/src/hal/user_comps/vismach/puma560gui.py b/src/hal/user_comps/vismach/puma560gui.py index bdd9affb243..87b265bf2fa 100755 --- a/src/hal/user_comps/vismach/puma560gui.py +++ b/src/hal/user_comps/vismach/puma560gui.py @@ -57,13 +57,13 @@ def popupmsg(): import hal c = hal.component("puma560gui") -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint6", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("grip", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint3", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint4", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint5", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint6", hal.Type.REAL, hal.Dir.IN) +c.newpin("grip", hal.Type.REAL, hal.Dir.IN) c.ready() diff --git a/src/hal/user_comps/vismach/pumagui.py b/src/hal/user_comps/vismach/pumagui.py index 05399be4fac..40cf0b15273 100755 --- a/src/hal/user_comps/vismach/pumagui.py +++ b/src/hal/user_comps/vismach/pumagui.py @@ -79,12 +79,12 @@ def popupmsg(): import hal c = hal.component("pumagui") -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint6", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint3", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint4", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint5", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint6", hal.Type.REAL, hal.Dir.IN) c.ready() ################### diff --git a/src/hal/user_comps/vismach/rotarydelta.py b/src/hal/user_comps/vismach/rotarydelta.py index da1beee2f31..d27e5d9c14a 100755 --- a/src/hal/user_comps/vismach/rotarydelta.py +++ b/src/hal/user_comps/vismach/rotarydelta.py @@ -59,13 +59,13 @@ def popupmsg(): for setting in sys.argv[1:]: exec(setting) c = hal.component("rotarydelta") -c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("pfr", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tl", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("sl", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("fr", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint0", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("pfr", hal.Type.REAL, hal.Dir.IN) +c.newpin("tl", hal.Type.REAL, hal.Dir.IN) +c.newpin("sl", hal.Type.REAL, hal.Dir.IN) +c.newpin("fr", hal.Type.REAL, hal.Dir.IN) c['pfr'], c['tl'], c['sl'], c['fr'] = rotarydeltakins.get_geometry() c.ready() diff --git a/src/hal/user_comps/vismach/scaragui.py b/src/hal/user_comps/vismach/scaragui.py index 5a0082ea5c4..4a38f2c8cb2 100755 --- a/src/hal/user_comps/vismach/scaragui.py +++ b/src/hal/user_comps/vismach/scaragui.py @@ -56,12 +56,12 @@ def popupmsg(): import sys c = hal.component("scaragui") -c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("joint0", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint1", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint2", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint3", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint4", hal.Type.REAL, hal.Dir.IN) +c.newpin("joint5", hal.Type.REAL, hal.Dir.IN) c.ready() # parameters that define the geometry see scarakins.c for definitions these diff --git a/src/hal/user_comps/vismach/xyzab-tdr-gui.py b/src/hal/user_comps/vismach/xyzab-tdr-gui.py index c70ca7c477b..1f62874dd9f 100644 --- a/src/hal/user_comps/vismach/xyzab-tdr-gui.py +++ b/src/hal/user_comps/vismach/xyzab-tdr-gui.py @@ -66,26 +66,26 @@ def popupmsg(): c = hal.component("xyzab-tdr-gui") # axis-x -c.newpin("axis-x", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("axis-x", hal.Type.REAL, hal.Dir.IN) # axis-y -c.newpin("axis-y", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("axis-y", hal.Type.REAL, hal.Dir.IN) # axis-z -c.newpin("axis-z", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("axis-z", hal.Type.REAL, hal.Dir.IN) # rotary_a -c.newpin("rotary-a", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotary-a", hal.Type.REAL, hal.Dir.IN) # rotary_b -c.newpin("rotary-b", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotary-b", hal.Type.REAL, hal.Dir.IN) # geometric offsets between A and B axes -c.newpin("x_offset", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("z_offset", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("x_offset", hal.Type.REAL, hal.Dir.IN) +c.newpin("z_offset", hal.Type.REAL, hal.Dir.IN) # rot-point offsets -c.newpin("x-rot-point", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("y-rot-point", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("z-rot-point", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("x-rot-point", hal.Type.REAL, hal.Dir.IN) +c.newpin("y-rot-point", hal.Type.REAL, hal.Dir.IN) +c.newpin("z-rot-point", hal.Type.REAL, hal.Dir.IN) # tool-length offset # tool offsets -c.newpin("tool_length", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool_diameter", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tool_length", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool_diameter", hal.Type.REAL, hal.Dir.IN) c.ready() # These values are arbitrary and are meant to simulate an absolute diff --git a/src/hal/user_comps/vismach/xyzac-trt-gui.py b/src/hal/user_comps/vismach/xyzac-trt-gui.py index 3e7c5fcb879..021dd2e2a1c 100755 --- a/src/hal/user_comps/vismach/xyzac-trt-gui.py +++ b/src/hal/user_comps/vismach/xyzac-trt-gui.py @@ -63,19 +63,19 @@ def popupmsg(): c = hal.component("xyzac-trt-gui") # table-x -c.newpin("table-x", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("table-x", hal.Type.REAL, hal.Dir.IN) # saddle-y -c.newpin("saddle-y", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("saddle-y", hal.Type.REAL, hal.Dir.IN) # head vertical slide -c.newpin("spindle-z", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("spindle-z", hal.Type.REAL, hal.Dir.IN) # table-x tilt-b -c.newpin("tilt-a", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tilt-a", hal.Type.REAL, hal.Dir.IN) # rotary table-x -c.newpin("rotate-c", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotate-c", hal.Type.REAL, hal.Dir.IN) # offsets -c.newpin("y-offset", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("z-offset", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool-offset", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("y-offset", hal.Type.REAL, hal.Dir.IN) +c.newpin("z-offset", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool-offset", hal.Type.REAL, hal.Dir.IN) c.ready() for setting in sys.argv[1:]: exec(setting) diff --git a/src/hal/user_comps/vismach/xyzbc-trt-gui.py b/src/hal/user_comps/vismach/xyzbc-trt-gui.py index 0804a29ed2b..a6185242331 100755 --- a/src/hal/user_comps/vismach/xyzbc-trt-gui.py +++ b/src/hal/user_comps/vismach/xyzbc-trt-gui.py @@ -62,18 +62,18 @@ def popupmsg(): c = hal.component("xyzbc-trt-gui") # table-x -c.newpin("table-x", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("table-x", hal.Type.REAL, hal.Dir.IN) # saddle-y -c.newpin("saddle-y", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("saddle-y", hal.Type.REAL, hal.Dir.IN) # head vertical slide -c.newpin("spindle-z", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("spindle-z", hal.Type.REAL, hal.Dir.IN) # table-x tilt-b -c.newpin("tilt-b", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("tilt-b", hal.Type.REAL, hal.Dir.IN) # rotary table-x -c.newpin("rotate-c", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("z-offset", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("x-offset", hal.HAL_FLOAT, hal.HAL_IN) -c.newpin("tool-offset", hal.HAL_FLOAT, hal.HAL_IN) +c.newpin("rotate-c", hal.Type.REAL, hal.Dir.IN) +c.newpin("z-offset", hal.Type.REAL, hal.Dir.IN) +c.newpin("x-offset", hal.Type.REAL, hal.Dir.IN) +c.newpin("tool-offset", hal.Type.REAL, hal.Dir.IN) c.ready() for setting in sys.argv[1:]: exec(setting) diff --git a/src/hal/user_comps/wj200_vfd/wj200_vfd.comp b/src/hal/user_comps/wj200_vfd/wj200_vfd.comp index 71b1c9cf86b..5766a8e24e2 100644 --- a/src/hal/user_comps/wj200_vfd/wj200_vfd.comp +++ b/src/hal/user_comps/wj200_vfd/wj200_vfd.comp @@ -1,5 +1,5 @@ component wj200_vfd "Hitachi wj200 modbus driver"; -param rw ui32 mbslaveaddr "Modbus slave address"; +param rw uint mbslaveaddr "Modbus slave address"; param rw real frequency_scale = 1 "RPM / frequency, default 1"; pin in real commanded_frequency "Frequency of vfd (scaled to RPM)"; pin out real motor_frequency "Motor's actual frequency (scaled to RPM)"; @@ -174,7 +174,7 @@ bool wj200_getStatus(modbus_t* ctx, wj200_status* status) void print_modbus_error(struct __comp_state *__comp_inst, const char* msg) { fprintf(stderr, - "Error: wj200_vfd slave(%u): %s - Modbus error (%d) - %s\n", + "Error: wj200_vfd slave(%lu): %s - Modbus error (%d) - %s\n", mbslaveaddr, msg, errno, diff --git a/src/hal/user_comps/xhc-hb04.cc b/src/hal/user_comps/xhc-hb04.cc index 920cccfa245..6e928fd067d 100644 --- a/src/hal/user_comps/xhc-hb04.cc +++ b/src/hal/user_comps/xhc-hb04.cc @@ -526,7 +526,7 @@ static int hal_pin_simu(char *pin_name, void **ptr, int s) return 0; } -int _hal_pin_float_newf(hal_pin_dir_t dir, hal_real_t *data_ptr_addr, int comp_id, const char *fmt, ...) +int _hal_pin_float_newf(hal_pdir_t dir, hal_real_t *data_ptr_addr, int comp_id, const char *fmt, ...) { char pin_name[256]; va_list args; @@ -542,7 +542,7 @@ int _hal_pin_float_newf(hal_pin_dir_t dir, hal_real_t *data_ptr_addr, int comp_i } } -int _hal_pin_s32_newf(hal_pin_dir_t dir, hal_sint_t *data_ptr_addr, int comp_id, const char *fmt, ...) +int _hal_pin_s32_newf(hal_pdir_t dir, hal_sint_t *data_ptr_addr, int comp_id, const char *fmt, ...) { char pin_name[256]; va_list args; @@ -558,7 +558,7 @@ int _hal_pin_s32_newf(hal_pin_dir_t dir, hal_sint_t *data_ptr_addr, int comp_id, } } -int _hal_pin_bit_newf(hal_pin_dir_t dir, hal_bool_t *data_ptr_addr, int comp_id, const char *fmt, ...) +int _hal_pin_bit_newf(hal_pdir_t dir, hal_bool_t *data_ptr_addr, int comp_id, const char *fmt, ...) { char pin_name[256]; va_list args; diff --git a/src/hal/user_comps/xhc-whb04b-6/hal.cc b/src/hal/user_comps/xhc-whb04b-6/hal.cc index 843643490e0..f75611c6b06 100644 --- a/src/hal/user_comps/xhc-whb04b-6/hal.cc +++ b/src/hal/user_comps/xhc-whb04b-6/hal.cc @@ -232,7 +232,7 @@ int Hal::newSimulatedHalPin(char* /*pin_name*/, void** ptr, int s) return 0; } // ---------------------------------------------------------------------- -int Hal::newHalFloat(hal_pin_dir_t direction, hal_real_t *ptr, int componentId, const char *fmt, ...) +int Hal::newHalFloat(hal_pdir_t direction, hal_real_t *ptr, int componentId, const char *fmt, ...) { char pin_name[256]; va_list args; @@ -242,7 +242,7 @@ int Hal::newHalFloat(hal_pin_dir_t direction, hal_real_t *ptr, int componentId, assert(strlen(pin_name) < HAL_NAME_LEN); - *mHalCout << "hal float "; + *mHalCout << "hal real "; if (direction == HAL_OUT) { *mHalCout << "out "; @@ -268,7 +268,7 @@ int Hal::newHalFloat(hal_pin_dir_t direction, hal_real_t *ptr, int componentId, } } // ---------------------------------------------------------------------- -int Hal::newHalSigned32(hal_pin_dir_t direction, hal_sint_t *ptr, int componentId, const char *fmt, ...) +int Hal::newHalSigned32(hal_pdir_t direction, hal_sint_t *ptr, int componentId, const char *fmt, ...) { char pin_name[256]; va_list args; @@ -278,7 +278,7 @@ int Hal::newHalSigned32(hal_pin_dir_t direction, hal_sint_t *ptr, int componentI assert(strlen(pin_name) < HAL_NAME_LEN); - *mHalCout << "hal s32 "; + *mHalCout << "hal sint "; if (direction == HAL_OUT) { *mHalCout << "out "; @@ -304,7 +304,7 @@ int Hal::newHalSigned32(hal_pin_dir_t direction, hal_sint_t *ptr, int componentI } } // ---------------------------------------------------------------------- -int Hal::newHalUnsigned32(hal_pin_dir_t direction, hal_uint_t *ptr, int componentId, const char *fmt, ...) +int Hal::newHalUnsigned32(hal_pdir_t direction, hal_uint_t *ptr, int componentId, const char *fmt, ...) { char pin_name[256]; va_list args; @@ -314,7 +314,7 @@ int Hal::newHalUnsigned32(hal_pin_dir_t direction, hal_uint_t *ptr, int componen assert(strlen(pin_name) < HAL_NAME_LEN); - *mHalCout << "hal u32 "; + *mHalCout << "hal uint "; if (direction == HAL_OUT) { *mHalCout << "out "; @@ -340,7 +340,7 @@ int Hal::newHalUnsigned32(hal_pin_dir_t direction, hal_uint_t *ptr, int componen } } // ---------------------------------------------------------------------- -int Hal::newHalBit(hal_pin_dir_t direction, hal_bool_t *ptr, int componentId, const char *fmt, ...) +int Hal::newHalBit(hal_pdir_t direction, hal_bool_t *ptr, int componentId, const char *fmt, ...) { char pin_name[256]; va_list args; @@ -350,7 +350,7 @@ int Hal::newHalBit(hal_pin_dir_t direction, hal_bool_t *ptr, int componentId, co assert(strlen(pin_name) < HAL_NAME_LEN); - *mHalCout << "hal bit "; + *mHalCout << "hal bool "; if (direction == HAL_OUT) { *mHalCout << "out "; diff --git a/src/hal/user_comps/xhc-whb04b-6/hal.h b/src/hal/user_comps/xhc-whb04b-6/hal.h index 28a64aa1858..b5c05324b9f 100644 --- a/src/hal/user_comps/xhc-whb04b-6/hal.h +++ b/src/hal/user_comps/xhc-whb04b-6/hal.h @@ -588,19 +588,19 @@ class Hal //! \param s size in bytes //! \return != 0 on error, 0 otherwise int newSimulatedHalPin(char* pin_name, void** ptr, int s); - //! \sa int newHalFloat(hal_pin_dir_t direction, hal_real_t* ptr, int componentId, const char* fmt, ...); - int newHalFloat(hal_pin_dir_t direction, hal_real_t* ptr, int componentId, const char* fmt, ...); - //! \sa int newHalSigned32(hal_pin_dir_t direction, hal_sint_t* ptr, int componentId, const char* fmt, ...); - int newHalSigned32(hal_pin_dir_t direction, hal_sint_t* ptr, int componentId, const char* fmt, ...); - //! \sa int newHalUnsigned32(hal_pin_dir_t direction, hal_sint_t* ptr, int componentId, const char* fmt, ...); - int newHalUnsigned32(hal_pin_dir_t direction, hal_uint_t* ptr, int componentId, const char* fmt, ...); + //! \sa int newHalFloat(hal_pdir_t direction, hal_real_t* ptr, int componentId, const char* fmt, ...); + int newHalFloat(hal_pdir_t direction, hal_real_t* ptr, int componentId, const char* fmt, ...); + //! \sa int newHalSigned32(hal_pdir_t direction, hal_sint_t* ptr, int componentId, const char* fmt, ...); + int newHalSigned32(hal_pdir_t direction, hal_sint_t* ptr, int componentId, const char* fmt, ...); + //! \sa int newHalUnsigned32(hal_pdir_t direction, hal_sint_t* ptr, int componentId, const char* fmt, ...); + int newHalUnsigned32(hal_pdir_t direction, hal_uint_t* ptr, int componentId, const char* fmt, ...); //! \param direction module input or output //! \param ptr will point to the allocated memory //! \param componentId hal id //! \param fmt the pin name when registered to hal //! \param ... va args //! \return != 0 on error, 0 otherwise - int newHalBit(hal_pin_dir_t direction, hal_bool_t* ptr, int componentId, const char* fmt, ...); + int newHalBit(hal_pdir_t direction, hal_bool_t* ptr, int componentId, const char* fmt, ...); //! allocates new hal pin according to \ref mIsSimulationMode //! \param pin pointer reference to the memory to be fred //! \post pin == nullptr diff --git a/src/hal/user_comps/z_level_compensation.py b/src/hal/user_comps/z_level_compensation.py index 366c2889587..07c1c94bd96 100644 --- a/src/hal/user_comps/z_level_compensation.py +++ b/src/hal/user_comps/z_level_compensation.py @@ -110,15 +110,15 @@ def compensate(self): def run(self): self.h = hal.component("z_level_compensation") - self.h.newpin("enable-in", hal.HAL_BIT, hal.HAL_IN) - self.h.newpin("scale", hal.HAL_FLOAT, hal.HAL_OUT) - self.h.newpin("counts", hal.HAL_S32, hal.HAL_OUT) - self.h.newpin("clear", hal.HAL_BIT, hal.HAL_IN) - self.h.newpin("x-pos", hal.HAL_FLOAT, hal.HAL_IN) - self.h.newpin("y-pos", hal.HAL_FLOAT, hal.HAL_IN) - self.h.newpin("z-pos", hal.HAL_FLOAT, hal.HAL_IN) - self.h.newpin("fade-height", hal.HAL_FLOAT, hal.HAL_IN) - self.h.newpin("method", hal.HAL_S32, hal.HAL_IN) + self.h.newpin("enable-in", hal.Type.BOOL, hal.Dir.IN) + self.h.newpin("scale", hal.Type.REAL, hal.Dir.OUT) + self.h.newpin("counts", hal.Type.SINT, hal.Dir.OUT) + self.h.newpin("clear", hal.Type.BOOL, hal.Dir.IN) + self.h.newpin("x-pos", hal.Type.REAL, hal.Dir.IN) + self.h.newpin("y-pos", hal.Type.REAL, hal.Dir.IN) + self.h.newpin("z-pos", hal.Type.REAL, hal.Dir.IN) + self.h.newpin("fade-height", hal.Type.REAL, hal.Dir.IN) + self.h.newpin("method", hal.Type.SINT, hal.Dir.IN) self.h.ready() self.stat = linuxcnc.stat() diff --git a/src/hal/utils/halcmd_commands.cc b/src/hal/utils/halcmd_commands.cc index 569293f2f4e..a890113e432 100644 --- a/src/hal/utils/halcmd_commands.cc +++ b/src/hal/utils/halcmd_commands.cc @@ -628,8 +628,8 @@ static hal_type_t typestr_to_haltype(const char *type, bool anycase) { "port", HAL_PORT }, { "bit", HAL_BOOL }, { "float", HAL_REAL }, - { "u32", HAL_U32 }, - { "s32", HAL_S32 }, + { "u32", HAL_UINT }, + { "s32", HAL_SINT }, { "u64", HAL_UINT }, { "s64", HAL_SINT }, { nullptr, HAL_TYPE_UNSPECIFIED } @@ -707,11 +707,9 @@ static std::string querydata_valuestr(hal_type_t type, const hal_query_value_u * return v->b ? "TRUE" : "FALSE"; case HAL_REAL: return fmt::format("{:.7g}", v->r); - case HAL_S32: case HAL_SINT: case HAL_PORT: return fmt::format("{}", v->s); - case HAL_U32: case HAL_UINT: return fmt::format("{}", v->u); default: @@ -792,8 +790,8 @@ static int get_type(const char ***patterns) { hal_type_t htype = typestr_to_haltype(typestr, false); if(htype != HAL_TYPE_UNINITIALIZED) return htype; - if(strcmp(typestr, "signed") == 0) return HAL_S32; - if(strcmp(typestr, "unsigned") == 0) return HAL_U32; + if(strcmp(typestr, "signed") == 0) return HAL_SINT; + if(strcmp(typestr, "unsigned") == 0) return HAL_UINT; return -1; } @@ -1900,12 +1898,10 @@ static void print_mem_status() static const char *data_type(hal_type_t type) { switch (type) { - case HAL_BOOL: return "bit "; - case HAL_REAL: return "float"; - case HAL_S32: return "s32 "; - case HAL_U32: return "u32 "; - case HAL_SINT: return "s64 "; - case HAL_UINT: return "u64 "; + case HAL_BOOL: return "bool "; + case HAL_REAL: return "real "; + case HAL_SINT: return "sint "; + case HAL_UINT: return "uint "; case HAL_PORT: return "port "; default: return "undef"; /* Shouldn't get here, but just in case... */ } @@ -1914,12 +1910,10 @@ static const char *data_type(hal_type_t type) static const char *data_type2(hal_type_t type) { switch (type) { - case HAL_BOOL: return "bit"; - case HAL_REAL: return "float"; - case HAL_S32: return "s32"; - case HAL_U32: return "u32"; - case HAL_SINT: return "s64"; - case HAL_UINT: return "u64"; + case HAL_BOOL: return "bool"; + case HAL_REAL: return "real"; + case HAL_SINT: return "sint"; + case HAL_UINT: return "uint"; case HAL_PORT: return "port"; default: return "undef"; /* Shouldn't get here, but just in case... */ } @@ -1978,15 +1972,11 @@ static std::string querydata_refstr_20(hal_type_t type, hal_refs_u u) return fmt::format("{:>20s}", hal_get_bool(u.b) ? "TRUE" : "FALSE"); case HAL_REAL: return fmt::format("{:20.7g}", hal_get_real(u.r)); - case HAL_S32: - return fmt::format("{:20d}", (long)hal_get_si32(u.s)); case HAL_SINT: case HAL_PORT: - return fmt::format("{:20d}", (long long)hal_get_sint(u.s)); - case HAL_U32: - return fmt::format(" 0x{:08X}", (unsigned long)hal_get_ui32(u.u)); + return fmt::format("{:20d}", hal_get_sint(u.s)); case HAL_UINT: - return fmt::format(" 0x{:016X}", (unsigned long long)hal_get_uint(u.u)); + return fmt::format(" 0x{:016X}", hal_get_uint(u.u)); default: /* Shouldn't get here, but just in case... */ return " undef "; @@ -2003,13 +1993,9 @@ static std::string querydata_refstr(hal_type_t type, hal_refs_u u) return hal_get_bool(u.b) ? "TRUE" : "FALSE"; case HAL_REAL: return fmt::format("{:.7g}", hal_get_real(u.r)); - case HAL_S32: - return fmt::format("{}", hal_get_si32(u.s)); case HAL_SINT: case HAL_PORT: return fmt::format("{}", hal_get_sint(u.s)); - case HAL_U32: - return fmt::format("{}", hal_get_ui32(u.u)); case HAL_UINT: return fmt::format("{}", hal_get_uint(u.u)); default: @@ -2477,7 +2463,7 @@ int do_help_cmd(const char *command) } else if (strcmp(command, "newsig") == 0) { printf("newsig signame type\n"); printf(" Creates a new signal called 'signame'. Type\n"); - printf(" is 'bit', 'float', 'port', 'u32', or 's32'.\n"); + printf(" is 'bool', 'real', 'port', 'uint', or 'sint'.\n"); } else if (strcmp(command, "delsig") == 0) { printf("delsig signame\n"); printf(" Deletes signal 'signame'. If 'signame is 'all',\n"); diff --git a/src/hal/utils/halcmd_completion.c b/src/hal/utils/halcmd_completion.c index 577a958f767..69e854eedd8 100644 --- a/src/hal/utils/halcmd_completion.c +++ b/src/hal/utils/halcmd_completion.c @@ -87,7 +87,7 @@ static const char *status_table[] = { }; static const char *pintype_table[] = { - "bit", "float", "u32", "s32", + "bool", "real", "uint", "sint", NULL }; @@ -120,14 +120,14 @@ static char **completion_matches_table(const char *text, const char **table, hal static hal_type_t match_type = -1; static int match_writers = -1; -static hal_pin_dir_t match_direction = HAL_DIR_UNSPECIFIED; +static hal_pdir_t match_direction = HAL_DIR_UNSPECIFIED; -static int direction_match(hal_pin_dir_t dir1, hal_pin_dir_t dir2) { +static int direction_match(hal_pdir_t dir1, hal_pdir_t dir2) { if(dir1 == HAL_DIR_UNSPECIFIED || dir2 == -1) return 1; return (dir1 | dir2) == HAL_IO; } -static int writer_match(hal_pin_dir_t dir, int writers) { +static int writer_match(hal_pdir_t dir, int writers) { if(writers == -1 || dir == -1) return 1; if(dir & HAL_IN || writers == 0) return 1; return 0; diff --git a/src/hal/utils/halcompile.g b/src/hal/utils/halcompile.g index 2690dc61df7..29931678b54 100644 --- a/src/hal/utils/halcompile.g +++ b/src/hal/utils/halcompile.g @@ -41,6 +41,7 @@ parser Hal: rule Declaration: "pin" PINDIRECTION TYPE HALNAME OptArray OptSAssign OptPersonality OptString ";" {{ pin(HALNAME, TYPE, OptArray, PINDIRECTION, OptString, OptSAssign, OptPersonality) }} | "param" PARAMDIRECTION TYPE HALNAME OptArray OptSAssign OptPersonality OptString ";" {{ param(HALNAME, TYPE, OptArray, PARAMDIRECTION, OptString, OptSAssign, OptPersonality) }} + | "alias" HALNAME OptArray {{ ppname = HALNAME; pparr = OptArray }} HALNAME OptArray ";" {{ alias(ppname, pparr, HALNAME, OptArray) }} | "function" NAME OptFP OptString ";" {{ function(NAME, OptFP, OptString) }} | "variable" NAME STARREDNAME OptSimpleArray OptAssign ";" {{ variable(NAME, STARREDNAME, OptSimpleArray, OptAssign) }} | "option" NAME OptValue ";" {{ option(NAME, OptValue) }} @@ -150,17 +151,27 @@ def parse(filename): return a, b dirmap = {'r': 'HAL_RO', 'rw': 'HAL_RW', 'in': 'HAL_IN', 'out': 'HAL_OUT', 'io': 'HAL_IO' } -typemap = {'signed': 's32', 'unsigned': 'u32'} -deprmap = {'s32': 'signed', 'u32': 'unsigned'} -deprecated = ['s32', 'u32'] +# Using any in the typemap will result in a warning +typemap = { + "bit": "bool", + "float": "real", + "s32": "si32", + "signed": "si32", + "u32": "ui32", + "unsigned": "ui32", + "s64": "sint", + "u64": "uint" } newtypes = ['bool', 'sint', 'uint', 'si32', 'ui32', 'real'] + def initialize(): global functions, params, pins, comp_name, names, docs, variables global modparams, includes + global aliases functions = []; params = []; pins = []; options = {}; variables = [] modparams = []; docs = []; includes = []; + aliases = {} comp_name = None names = {} @@ -169,11 +180,15 @@ def Warn(msg, *args): if args: msg = msg % args print("%s:%d: Warning: %s" % (S.filename, S.line, msg), file=sys.stderr) + if warn_is_error: + sys.exit(1) def Error(msg, *args): if args: msg = msg % args - raise runtime.SyntaxError(S.get_pos(), msg, None) + print("%s:%d: Error: %s" % (S.filename, S.line, msg), file=sys.stderr) + sys.exit(1) + #raise runtime.SyntaxError(S.get_pos(), msg, None) def optfp_warn(state): s = "nofp" if 0 == state else "fp" @@ -208,8 +223,10 @@ def notes(doc): docs.append(('notes', doc)); def type2type(type_): - # When we start warning about s32/u32 this is where the warning goes - return typemap.get(type_, type_) + if type_ in typemap: + Warn(f"Old type '{type_}' has been replaced by '{typemap[type_]}'") + return typemap[type_] + return type_ def checkarray(name, array): hashes = len(re.findall("#+", name)) @@ -230,21 +247,39 @@ def pin(name, type_, array, dir_, doc, value, personality): type_ = type2type(type_) check_name_ok(name) docs.append(('pin', name, type_, array, dir_, doc, value, personality)) - names[name] = None + names[name] = 'pin' pins.append((name, type_, array, dir_, value, personality)) def param(name, type_, array, dir_, doc, value, personality): + if 'port' == type_: + Error("Parameters cannot be of type 'port'") checkarray(name, array) type_ = type2type(type_) check_name_ok(name) docs.append(('param', name, type_, array, dir_, doc, value, personality)) - names[name] = None + names[name] = 'param' params.append((name, type_, array, dir_, value, personality)) +def alias(name, namearr, aliasname, aliasarr): + if namearr != aliasarr: + Error(f"Alias arrays for pin '{namearr}' != '{aliasarr}'") + checkarray(name, namearr) + checkarray(aliasname, aliasarr) + if aliasname in names: + Error(f"Alias name '{aliasname}' already in use") + if name not in names: + Error(f"Pin/param name '{name}' not found, cannot alias") + if name in aliases: + Error(f"Alias for pin/param '{name}' already exists as '{aliases[name][2]}'") + if names[name] not in ('pin', 'param'): + Error(f"Expected '{name}' to be pin or param, but got '{names[name]}'"); + aliases[name] = (name, namearr, aliasname, aliasarr, names[name]) + names[aliasname] = 'alias' # Must register to prevent collision + def function(name, fp, doc): check_name_ok(name) docs.append(('funct', name, fp, doc)) - names[name] = None + names[name] = 'function' functions.append((name, fp)) def option(name, value): @@ -254,12 +289,12 @@ def option(name, value): def variable(type_, name, array, default): check_name_ok(name) - names[name] = None + names[name] = 'variable' variables.append((type_, name, array, default)) def modparam(type_, name, default, doc): check_name_ok(name) - names[name] = None + names[name] = 'modparam' modparams.append((type_, name, default, doc)) def include(value): @@ -350,7 +385,7 @@ static int comp_id; print(" int _personality;", file=f) for name, type_, array, dir_, value, personality in pins: - star = '' if type_ in newtypes else '*' + star = '' if type_ in newtypes or 'port' == type_ else '*' if array: if isinstance(array, tuple): array = array[0] print(" hal_%s_t %s%s_p[%s];" % (to_t(type_), star, to_c(name), array), file=f) @@ -457,6 +492,9 @@ static int comp_id; dflt = "%s" % value if value is not None else "0" print(" r = hal_pin_new_%s(comp_id, %s, &(inst->%s_p[j]), %s," % ( type_, dirmap[dir_], to_c(name), dflt), file=f) + elif 'port' == type_: + print(" r = hal_pin_new_%s(comp_id, %s, &(inst->%s_p[j])," % ( + type_, dirmap[dir_], to_c(name)), file=f) else: print(" r = hal_pin_%s_newf(%s, &(inst->%s_p[j]), comp_id," % ( type_, dirmap[dir_], to_c(name)), file=f) @@ -470,6 +508,10 @@ static int comp_id; dflt = "%s" % value if value is not None else "0" print(" r = hal_pin_new_%s(comp_id, %s, &(inst->%s_p), %s," % ( type_, dirmap[dir_], to_c(name), dflt), file=f) + elif 'port' == type_: + dflt = "%s" % value if value is not None else "0" + print(" r = hal_pin_new_%s(comp_id, %s, &(inst->%s_p)," % ( + type_, dirmap[dir_], to_c(name)), file=f) else: print(" r = hal_pin_%s_newf(%s, &(inst->%s_p), comp_id," % ( type_, dirmap[dir_], to_c(name)), file=f) @@ -522,6 +564,35 @@ static int comp_id; if personality: print("}", file=f) + if len(aliases) > 0: + print(" {", file=f) + print(" char pinname[HAL_NAME_LEN+1], alsname[HAL_NAME_LEN+1];", file=f) + for k, v in aliases.items(): + name, namearr, aliasname, aliasarr, nametype = v + if isinstance(array, tuple): + lim, cnt = array + print(" if((%s) > (%s)) {" % (cnt, lim), file=f) + print(' rtapi_print_msg(RTAPI_MSG_ERR,' \ + '"Alias %s: Requested size %%d exceeds max size %%d\\n",' + '(int)(%s), (int)(%s));' % (name, cnt, lim), file=f) + print(" return -ENOSPC;", file=f) + print(" }", file=f) + else: + cnt = array + if namearr: + print( " for(j = 0; j < (%s); j++) {" % cnt, file=f) + print(f" rtapi_snprintf(pinname, sizeof(pinname), \"%s.{to_hal(name)}\", prefix, j);", file=f) + print(f" rtapi_snprintf(alsname, sizeof(alsname), \"%s.{to_hal(aliasname)}\", prefix, j);", file=f) + print(f" r = {nametype}(pinname, alsname);", file=f) + print( " if(r != 0) return r;", file=f) + print( " }" % cnt, file=f) + else: + print(f" rtapi_snprintf(pinname, sizeof(pinname), \"%s.{to_hal(name)}\", prefix);", file=f) + print(f" rtapi_snprintf(alsname, sizeof(alsname), \"%s.{to_hal(aliasname)}\", prefix);", file=f) + print(f" r = hal_{nametype}_alias(pinname, alsname);", file=f) + print( " if(r != 0) return r;", file=f) + print(" }", file=f) + for type_, name, array, value in variables: if value is None: continue if array: @@ -534,8 +605,8 @@ static int comp_id; for name, fp in functions: print(" rtapi_snprintf(buf, sizeof(buf), \"%%s%s\", prefix);"\ % to_hal("." + name), file=f) - print(" r = hal_export_funct(buf, (void(*)(void *inst, long))%s, inst, %s, 0, comp_id);" % ( - to_c(name), int(fp)), file=f) + print(" r = hal_export_funct(buf, (void(*)(void *inst, long))%s, inst, 0, comp_id);" % ( + to_c(name)), file=f) print(" if(r != 0) return r;", file=f) print(" if(__comp_last_inst) __comp_last_inst->_next = inst;", file=f) print(" __comp_last_inst = inst;", file=f) @@ -1333,6 +1404,8 @@ def main(): require_license = True global require_unix_line_endings require_unix_line_endings = False + global warn_is_error + warn_is_error = False mode = PREPROCESS adoc = False keepadoc = None @@ -1341,12 +1414,12 @@ def main(): global options options = {} try: - opts, args = getopt.getopt(sys.argv[1:], "UluijJcpdak:o:h?P:", + opts, args = getopt.getopt(sys.argv[1:], "UluijJcpdak:o:h?P:w", ['unix', 'install', 'compile', 'preprocess', 'outfile=', 'document', 'adoc', 'keep-adoc=', 'help', 'userspace', 'install-doc', 'view-doc', 'require-license', 'print-modinc', 'personalities=', "extra-compile-args=", - 'extra-link-args=']) + 'extra-link-args=', 'werror']) except getopt.GetoptError: usage(1) for k, v in opts: @@ -1393,6 +1466,8 @@ def main(): option("extra_link_args", v) if k in ("-?", "-h", "--help"): usage(0) + if k in ("-w", "--werror"): + warn_is_error = True if outfile and mode != PREPROCESS and mode != DOCUMENT: raise SystemExit("Can only specify -o when preprocessing or documenting") diff --git a/src/hal/utils/halrmt.cc b/src/hal/utils/halrmt.cc index 821d4db2329..a4071eb4f8b 100644 --- a/src/hal/utils/halrmt.cc +++ b/src/hal/utils/halrmt.cc @@ -366,8 +366,6 @@ static const char *data_type(hal_type_t type) switch (type) { case HAL_BOOL: return "bool "; case HAL_REAL: return "real "; - case HAL_S32: return "s32 "; - case HAL_U32: return "u32 "; case HAL_SINT: return "sint "; case HAL_UINT: return "uint "; case HAL_PORT: return "port "; @@ -424,9 +422,7 @@ static std::string data_value(hal_type_t type, hal_query_value_u val) case HAL_BOOL: return val.b ? " TRUE" : " FALSE"; case HAL_REAL: return fmt::format("{:12.7g}", val.r); case HAL_PORT: // FIXME - case HAL_S32: case HAL_SINT: return fmt::format(" {:10d}", val.s); - case HAL_U32: case HAL_UINT: return fmt::format(" {:08X}", val.u); default: return " undef "; } @@ -438,9 +434,7 @@ static std::string data_value2(hal_type_t type, hal_query_value_u val) case HAL_BOOL: return val.b ? "TRUE" : "FALSE"; case HAL_REAL: return fmt::format("{:.7g}", val.r); case HAL_PORT: // FIXME - case HAL_S32: case HAL_SINT: return fmt::format("{}", val.s); - case HAL_U32: case HAL_UINT: return fmt::format("{}", val.u); default: return "unknown_type"; } @@ -2101,10 +2095,10 @@ static hal_type_t haltype_from_str(const std::string &str) { "bool", HAL_BOOL }, { "float", HAL_REAL }, { "real", HAL_REAL }, - { "s32", HAL_S32 }, + { "s32", HAL_SINT }, { "s64", HAL_SINT }, { "sint", HAL_SINT }, - { "u32", HAL_U32 }, + { "u32", HAL_UINT }, { "u64", HAL_UINT }, { "uint", HAL_UINT }, }; diff --git a/src/hal/utils/halsh.c b/src/hal/utils/halsh.c index e0e4d70591c..38ba87dc461 100644 --- a/src/hal/utils/halsh.c +++ b/src/hal/utils/halsh.c @@ -111,13 +111,11 @@ static int halsh_format_one(Tcl_Interp *interp, hal_stream_data_u v) { char buf[64]; switch(hal_stream_element_type(s, idx)) { - case HAL_BIT: snprintf(buf, sizeof(buf), "%d", v.b ? 1 : 0); break; - case HAL_FLOAT: snprintf(buf, sizeof(buf), "%g", v.f); break; - case HAL_S32: snprintf(buf, sizeof(buf), "%lld", (long long)v.s); break; - case HAL_U32: snprintf(buf, sizeof(buf), "%llu", (unsigned long long)v.u); break; - case HAL_S64: snprintf(buf, sizeof(buf), "%lld", (long long)v.l); break; - case HAL_U64: snprintf(buf, sizeof(buf), "%llu", (unsigned long long)v.k); break; - default: snprintf(buf, sizeof(buf), "0"); break; + case HAL_BOOL: snprintf(buf, sizeof(buf), "%d", v.b ? 1 : 0); break; + case HAL_REAL: snprintf(buf, sizeof(buf), "%g", v.f); break; + case HAL_SINT: snprintf(buf, sizeof(buf), "%lld", (long long)v.l); break; + case HAL_UINT: snprintf(buf, sizeof(buf), "%llu", (unsigned long long)v.k); break; + default: snprintf(buf, sizeof(buf), "0"); break; } Tcl_AppendElement(interp, buf); return TCL_OK; diff --git a/src/hal/utils/meter.c b/src/hal/utils/meter.c index e371379955c..967ef4fce97 100644 --- a/src/hal/utils/meter.c +++ b/src/hal/utils/meter.c @@ -543,16 +543,6 @@ static const char *data_value(hal_type_t type, hal_refs_u ref) snprintf(buf, sizeof(buf), "%.7g", (double)hal_get_real(ref.r)); value_str = buf; break; - case HAL_S32: - snprintf(buf, sizeof(buf), "%10ld", (long)hal_get_si32(ref.s)); - value_str = buf; - break; - case HAL_U32: { - unsigned long v = hal_get_ui32(ref.u); - snprintf(buf, sizeof(buf), "%10lu (0x%08lX)", v, v); - value_str = buf; - } - break; case HAL_SINT: snprintf(buf, sizeof(buf), "%10lld", (long long)hal_get_sint(ref.s)); value_str = buf; diff --git a/src/hal/utils/scope_disp.c b/src/hal/utils/scope_disp.c index 4953b697048..b243e9c554c 100644 --- a/src/hal/utils/scope_disp.c +++ b/src/hal/utils/scope_disp.c @@ -163,12 +163,6 @@ static void calculate_offset(int chan_num) { case HAL_REAL: value = dptr->r; break; - case HAL_S32: - value = dptr->s; - break; - case HAL_U32: - value = dptr->u; - break; case HAL_SINT: value = dptr->s; break; @@ -828,12 +822,6 @@ void draw_waveform(int chan_num, int highlight) case HAL_REAL: fy = dptr->r; break; - case HAL_S32: - fy = dptr->s; - break; - case HAL_U32: - fy = dptr->u; - break; case HAL_SINT: fy = dptr->s; break; diff --git a/src/hal/utils/scope_files.c b/src/hal/utils/scope_files.c index 199f37c7f27..19daacb400a 100644 --- a/src/hal/utils/scope_files.c +++ b/src/hal/utils/scope_files.c @@ -628,13 +628,11 @@ void read_log_file(char *filename) chan->min_index = -36; chan->max_index = 36; break; - case HAL_S32: case HAL_SINT: chan->data_len = sizeof(scope_data_t); chan->min_index = -2; chan->max_index = 30; break; - case HAL_U32: case HAL_UINT: chan->data_len = sizeof(scope_data_t); chan->min_index = -2; @@ -753,12 +751,6 @@ void read_log_file(char *filename) case HAL_REAL: dptr->r = (rtapi_real)value; break; - case HAL_S32: - dptr->s = (rtapi_s32)value; - break; - case HAL_U32: - dptr->u = (rtapi_u32)value; - break; case HAL_SINT: dptr->s = (rtapi_sint)value; break; @@ -846,12 +838,6 @@ static void write_sample(FILE *fp, scope_data_t *dptr, hal_type_t type) case HAL_REAL: data_value = dptr->r; break; - case HAL_S32: - data_value = dptr->s; - break; - case HAL_U32: - data_value = dptr->u; - break; case HAL_SINT: data_value = dptr->s; break; diff --git a/src/hal/utils/scope_rt.c b/src/hal/utils/scope_rt.c index cb3aca04b17..742eab77b6c 100644 --- a/src/hal/utils/scope_rt.c +++ b/src/hal/utils/scope_rt.c @@ -128,7 +128,7 @@ int rtapi_app_main(void) init_rt_control_struct(shm_base); /* export scope data sampling function */ - retval = hal_export_funct("scope.sample", sample, NULL, 0, 0, comp_id); + retval = hal_export_funct("scope.sample", sample, NULL, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "SCOPE_RT: ERROR: sample funct export failed\n"); @@ -266,8 +266,6 @@ static void capture_sample(void) continue; switch(ctrl_rt->data_type[n]) { case HAL_BOOL: dest->b = hal_get_bool(ctrl_rt->data_addr[n].b); dest++; break; - case HAL_S32: dest->s = hal_get_si32(ctrl_rt->data_addr[n].s); dest++; break; - case HAL_U32: dest->u = hal_get_ui32(ctrl_rt->data_addr[n].u); dest++; break; case HAL_SINT: dest->s = hal_get_sint(ctrl_rt->data_addr[n].s); dest++; break; case HAL_UINT: dest->u = hal_get_uint(ctrl_rt->data_addr[n].u); dest++; break; case HAL_REAL: dest->r = hal_get_real(ctrl_rt->data_addr[n].r); dest++; break; @@ -316,15 +314,9 @@ static int check_trigger(void) case HAL_BOOL: compare_result = hal_get_bool(ctrl_rt->data_addr[ctrl_shm->trig_chan - 1].b); break; - case HAL_S32: - compare_result = hal_get_si32(ctrl_rt->data_addr[ctrl_shm->trig_chan - 1].s) > level->s; - break; case HAL_SINT: compare_result = hal_get_sint(ctrl_rt->data_addr[ctrl_shm->trig_chan - 1].s) > level->s; break; - case HAL_U32: - compare_result = hal_get_ui32(ctrl_rt->data_addr[ctrl_shm->trig_chan - 1].u) > level->u; - break; case HAL_UINT: compare_result = hal_get_uint(ctrl_rt->data_addr[ctrl_shm->trig_chan - 1].u) > level->u; break; diff --git a/src/hal/utils/scope_trig.c b/src/hal/utils/scope_trig.c index 68d436ed783..3211e13b18a 100644 --- a/src/hal/utils/scope_trig.c +++ b/src/hal/utils/scope_trig.c @@ -137,24 +137,6 @@ void refresh_trigger(void) case HAL_REAL: ctrl_shm->trig_level.r = fp_level; break; - case HAL_S32: - if (fp_level > (rtapi_real)RTAPI_INT32_MAX) { - fp_level = (rtapi_real)RTAPI_INT32_MAX; - } - if (fp_level < (rtapi_real)RTAPI_INT32_MIN) { - fp_level = (rtapi_real)RTAPI_INT32_MIN; - } - ctrl_shm->trig_level.s = fp_level; - break; - case HAL_U32: - if (fp_level > (rtapi_real)RTAPI_UINT32_MAX) { - fp_level = (rtapi_real)RTAPI_UINT32_MAX; - } - if (fp_level < 0.0) { - fp_level = 0.0; - } - ctrl_shm->trig_level.u = fp_level; - break; case HAL_SINT: if (fp_level > (rtapi_real)RTAPI_SINT_MAX) { fp_level = (rtapi_real)RTAPI_SINT_MAX; diff --git a/src/hal/utils/scope_vert.c b/src/hal/utils/scope_vert.c index daddb16b3c8..120777ca819 100644 --- a/src/hal/utils/scope_vert.c +++ b/src/hal/utils/scope_vert.c @@ -255,13 +255,11 @@ int set_channel_source(int chan_num, int type, char *name) chan->min_index = -36; chan->max_index = 36; break; - case HAL_S32: case HAL_SINT: chan->data_len = sizeof(scope_data_t); chan->min_index = -2; chan->max_index = 30; break; - case HAL_U32: case HAL_UINT: chan->data_len = sizeof(scope_data_t); chan->min_index = -2; diff --git a/src/rtapi/examples/fifo/fifotask.c b/src/rtapi/examples/fifo/fifotask.c index e24cb44a56f..5d0b16843ca 100644 --- a/src/rtapi/examples/fifo/fifotask.c +++ b/src/rtapi/examples/fifo/fifotask.c @@ -119,7 +119,7 @@ int rtapi_app_main(void) /* create the fifo task */ fifo_task = rtapi_task_new(fifo_code, 0 /* arg */ , fifo_prio, module, - FIFO_STACKSIZE, RTAPI_NO_FP); + FIFO_STACKSIZE); if (fifo_task < 0) { rtapi_print("fifotask init: rtapi_task_new failed with %d\n", fifo_task); diff --git a/src/rtapi/examples/semaphore/master.c b/src/rtapi/examples/semaphore/master.c index af7e33df33c..f6549a5fa6f 100644 --- a/src/rtapi/examples/semaphore/master.c +++ b/src/rtapi/examples/semaphore/master.c @@ -102,7 +102,7 @@ int rtapi_app_main(void) /* create the master task */ master_task = rtapi_task_new(master_code, 0 /* arg */ , master_prio, module, - MASTER_STACKSIZE, RTAPI_NO_FP); + MASTER_STACKSIZE); if (master_task < 0) { rtapi_print("sem master init: rtapi_task_new returned %d\n", master_task); diff --git a/src/rtapi/examples/semaphore/slave.c b/src/rtapi/examples/semaphore/slave.c index 87d1d4e401e..de57d800919 100644 --- a/src/rtapi/examples/semaphore/slave.c +++ b/src/rtapi/examples/semaphore/slave.c @@ -68,7 +68,7 @@ int rtapi_app_main(void) /* create the slave task */ slave_task = rtapi_task_new(slave_code, 0 /* arg */ , slave_prio, module, - SLAVE_STACKSIZE, RTAPI_NO_FP); + SLAVE_STACKSIZE); if (slave_task < 0) { rtapi_print("sem slave init: rtapi_task_new returned %d\n", slave_task); diff --git a/src/rtapi/examples/shmem/shmemtask.c b/src/rtapi/examples/shmem/shmemtask.c index 7088ba41328..60c417cd878 100644 --- a/src/rtapi/examples/shmem/shmemtask.c +++ b/src/rtapi/examples/shmem/shmemtask.c @@ -106,7 +106,7 @@ int rtapi_app_main(void) /* create the shmem task */ shmem_task = rtapi_task_new(shmem_code, 0 /* arg */ , shmem_prio, module, - SHMEM_STACKSIZE, RTAPI_NO_FP); + SHMEM_STACKSIZE); if (shmem_task < 0) { rtapi_print("shmemtask init: rtapi_task_new returned %d\n", shmem_task); diff --git a/src/rtapi/examples/timer/timertask.c b/src/rtapi/examples/timer/timertask.c index 68de062b080..baa06077f08 100644 --- a/src/rtapi/examples/timer/timertask.c +++ b/src/rtapi/examples/timer/timertask.c @@ -279,7 +279,7 @@ int rtapi_app_main(void) /* the second arg is an arbitrary int that is passed to the timer task on the first iteration */ timer_task = rtapi_task_new(timer_code, 0 /* arg */ , timer_prio, module, - TIMER_STACKSIZE, RTAPI_NO_FP); + TIMER_STACKSIZE); if (timer_task < 0) { /* See rtapi.h for the error codes returned */ rtapi_print("timertask init: rtapi_task_new returned %d\n", diff --git a/src/rtapi/rtai_rtapi.c b/src/rtapi/rtai_rtapi.c index 0ac0e050361..c15efe70add 100644 --- a/src/rtapi/rtai_rtapi.c +++ b/src/rtapi/rtai_rtapi.c @@ -622,7 +622,7 @@ static int rtapi_trap_handler(int vec, int signo, struct pt_regs *regs, } int rtapi_task_new(void (*taskcode) (void *), void *arg, - int prio, int owner, unsigned long int stacksize, int uses_fp) + int prio, int owner, unsigned long int stacksize) { int n; long task_id; @@ -667,8 +667,7 @@ int rtapi_task_new(void (*taskcode) (void *), void *arg, } task->taskcode = taskcode; task->arg = arg; - /* call OS to initialize the task - use predetermined CPU. - uses_fp is deprecated and ignored; always save FPU state. */ + /* call OS to initialize the task - use predetermined CPU. */ retval = rt_task_init_cpuid(ostask_array[task_id], wrapper, task_id, stacksize, prio, 1 /* always save FPU */, 0 /* signal */, rtapi_data->rt_cpu ); if (retval != 0) { diff --git a/src/rtapi/rtapi.h b/src/rtapi/rtapi.h index 40f5fa56cf1..c0a12aa73f1 100644 --- a/src/rtapi/rtapi.h +++ b/src/rtapi/rtapi.h @@ -378,9 +378,6 @@ RTAPI_BEGIN_DECLS * arbitrary void pointer when the task is started, and can be used to pass any * amount of data to the task (by pointing to a struct, or other such tricks). * - * @c uses_fp is deprecated and ignored. All tasks now unconditionally - * save and restore FPU/SSE state on context switch. This parameter - * will be removed in a future version. * @param taskcode Pointer to the function to be called when the task is * started. * @param arg Argument to be passed to the taskcode function. @@ -388,14 +385,13 @@ RTAPI_BEGIN_DECLS * @param owner ID of the module that is making the call see rtapi_init(). * @param stacksize The amount of stack to be used for the task, be generous, * hardware interrupts may use the same stack. - * @param uses_fp Deprecated and ignored. Kept for API compatibility. * @return On success, returns a positive integer task ID, @c task_id. This ID * is used for all subsequent calls that need to act on the task. On * failure, returns a negative error code as listed above. * @note Call only from within init/cleanup code, not from realtime tasks. */ extern int rtapi_task_new(void (*taskcode) (void *), void *arg, - int prio, int owner, unsigned long int stacksize, int uses_fp); + int prio, int owner, unsigned long int stacksize); /** * @brief Deletes a task. diff --git a/src/rtapi/uspace_rtai.cc b/src/rtapi/uspace_rtai.cc index d2776769fb2..0c4cc2322f1 100644 --- a/src/rtapi/uspace_rtai.cc +++ b/src/rtapi/uspace_rtai.cc @@ -110,7 +110,7 @@ struct RtaiApp : RtapiApp { task->rt_task = rt_task_init_schmod(task->id, task->prio, 0, 0, SCHED_FIFO, cpus_allowed); rt_set_periodic_mode(); start_rt_timer(nano2count(task->period)); - /* uses_fp is deprecated and ignored; always save FPU state */ + /* uses_fp is removed; always save FPU state */ rt_task_use_fpu(task->rt_task, 1); rt_make_hard_real_time(); rt_task_make_periodic_relative_ns(task->rt_task, task->period, task->period); diff --git a/src/rtapi/uspace_rtapi_app.cc b/src/rtapi/uspace_rtapi_app.cc index eecca0ae0d4..699eabb36c7 100644 --- a/src/rtapi/uspace_rtapi_app.cc +++ b/src/rtapi/uspace_rtapi_app.cc @@ -48,7 +48,7 @@ void WithRoot::init(uid_t ruid_ini, uid_t euid_ini) { } RtapiTask::RtapiTask() - : magic{}, id{}, owner{}, uses_fp{}, stacksize{}, prio{}, period{}, nextstart{}, pll_correction{}, + : magic{}, id{}, owner{}, stacksize{}, prio{}, period{}, nextstart{}, pll_correction{}, pll_correction_limit{}, arg{}, taskcode{} { @@ -120,8 +120,7 @@ int RtapiApp::allocate_task_id() { } int RtapiApp::task_new( - void (*taskcode)(void *), void *arg, int prio, int owner, unsigned long int stacksize, int /*uses_fp*/ -) { + void (*taskcode)(void *), void *arg, int prio, int owner, unsigned long int stacksize) { /* check requested priority */ if (!prio_check(prio)) { rtapi_print_msg( @@ -144,8 +143,6 @@ int RtapiApp::task_new( stacksize = (1024 * 1024); task->id = n; task->owner = owner; - /* uses_fp is deprecated and ignored; always save FPU state */ - task->uses_fp = 1; task->arg = arg; task->stacksize = stacksize; task->taskcode = taskcode; diff --git a/src/rtapi/uspace_rtapi_app.hh b/src/rtapi/uspace_rtapi_app.hh index beea58e4020..43e55b6b5a6 100644 --- a/src/rtapi/uspace_rtapi_app.hh +++ b/src/rtapi/uspace_rtapi_app.hh @@ -66,7 +66,6 @@ struct RtapiTask { int magic; /* to check for valid handle */ int id; int owner; - int uses_fp; size_t stacksize; int prio; long period; @@ -94,7 +93,7 @@ struct RtapiApp { int prio_next_higher(int prio) const; int prio_next_lower(int prio) const; long clock_set_period(long int period_nsec); - int task_new(void (*taskcode)(void *), void *arg, int prio, int owner, unsigned long int stacksize, int uses_fp); + int task_new(void (*taskcode)(void *), void *arg, int prio, int owner, unsigned long int stacksize); virtual RtapiTask *do_task_new() = 0; static int allocate_task_id(); static RtapiTask *get_task(int task_id); diff --git a/src/rtapi/uspace_rtapi_main.cc b/src/rtapi/uspace_rtapi_main.cc index 99f0af8b17d..32c5ddd8df4 100644 --- a/src/rtapi/uspace_rtapi_main.cc +++ b/src/rtapi/uspace_rtapi_main.cc @@ -1642,8 +1642,8 @@ long rtapi_clock_set_period(long nsecs) { return App().clock_set_period(nsecs); } -int rtapi_task_new(void (*taskcode)(void *), void *arg, int prio, int owner, unsigned long int stacksize, int uses_fp) { - return App().task_new(taskcode, arg, prio, owner, stacksize, uses_fp); +int rtapi_task_new(void (*taskcode)(void *), void *arg, int prio, int owner, unsigned long int stacksize) { + return App().task_new(taskcode, arg, prio, owner, stacksize); } int rtapi_task_delete(int id) { diff --git a/tcl/bin/halshow.tcl b/tcl/bin/halshow.tcl index 1c8bde45c17..3b7cd81e5c6 100755 --- a/tcl/bin/halshow.tcl +++ b/tcl/bin/halshow.tcl @@ -957,7 +957,7 @@ proc watchHAL {which} { $::cisp create text $::col1_width [expr $i * 20 + 13] -text $label \ -anchor w -tag $label -fill $labelcolor set canvaswidth [winfo width $::cisp] - if {$type == "bit"} { + if {$type == "bit" || $type == "bool"} { $::cisp create oval 10 [expr $i * 20 + 5] 25 [expr $i * 20 + 20] \ -fill lightgray -tag oval$i if {$writable == 1} { @@ -1279,7 +1279,9 @@ proc refreshItem {cnum vartype varname} { } else { switch $varnumtype { u32 - s32 {set varnumtype int} + uint - sint {set varnumtype int} float {set varnumtype float} + real {set varnumtype float} } if [catch { set value [expr $ret] } ] { set value $ret ;# allow display of a nan diff --git a/tests/abort/on_abort_command-crazy-move/test-ui.py b/tests/abort/on_abort_command-crazy-move/test-ui.py index 85a5e32255d..0fd8c1dc559 100755 --- a/tests/abort/on_abort_command-crazy-move/test-ui.py +++ b/tests/abort/on_abort_command-crazy-move/test-ui.py @@ -27,8 +27,8 @@ # Create and connect test feedback comp # h = hal.component("test-ui") -h.newpin("Xpos", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("Ypos", hal.HAL_FLOAT, hal.HAL_IN) +h.newpin("Xpos", hal.Type.REAL, hal.Dir.IN) +h.newpin("Ypos", hal.Type.REAL, hal.Dir.IN) h.ready() os.system("halcmd source ./postgui.hal") diff --git a/tests/abort/stop-button-crazy-move/test-ui.py b/tests/abort/stop-button-crazy-move/test-ui.py index 897c56e4926..839940e1e26 100755 --- a/tests/abort/stop-button-crazy-move/test-ui.py +++ b/tests/abort/stop-button-crazy-move/test-ui.py @@ -26,8 +26,8 @@ # Create and connect test feedback comp # h = hal.component("test-ui") -h.newpin("Xpos", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("Ypos", hal.HAL_FLOAT, hal.HAL_IN) +h.newpin("Xpos", hal.Type.REAL, hal.Dir.IN) +h.newpin("Ypos", hal.Type.REAL, hal.Dir.IN) h.ready() os.system("halcmd source ./postgui.hal") diff --git a/tests/classicladder/estop/classicladder-estop-ui.py b/tests/classicladder/estop/classicladder-estop-ui.py index 3f0f0ee859e..a579bb3b5d0 100755 --- a/tests/classicladder/estop/classicladder-estop-ui.py +++ b/tests/classicladder/estop/classicladder-estop-ui.py @@ -23,7 +23,7 @@ def wait_for_hal_pin(name, value, timeout=10): retval = 0 h = hal.component("python-ui") -h.newpin("ext-estop-button", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("ext-estop-button", hal.Type.BOOL, hal.Dir.OUT) h.ready() # mark the component as 'ready' hal.connect('python-ui.ext-estop-button', 'ext-estop') diff --git a/tests/hal-backslash/expected b/tests/hal-backslash/expected index 9f41ddd057f..a2315b700b5 100644 --- a/tests/hal-backslash/expected +++ b/tests/hal-backslash/expected @@ -1,4 +1,4 @@ Signals: Type Value Name (linked to) -bit TRUE hello +bool TRUE hello diff --git a/tests/hal-link-unlink/hallink.py b/tests/hal-link-unlink/hallink.py index 3ce6e9eee37..a63c5a7a31b 100755 --- a/tests/hal-link-unlink/hallink.py +++ b/tests/hal-link-unlink/hallink.py @@ -7,8 +7,8 @@ def cmd(arg): subprocess.call(arg, shell=True) h = hal.component("linktest") -h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("inout", hal.HAL_FLOAT, hal.HAL_IO) +h.newpin("in", hal.Type.REAL, hal.Dir.IN) +h.newpin("inout", hal.Type.REAL, hal.Dir.IO) h.ready() # set pin values before linking @@ -24,8 +24,8 @@ def cmd(arg): assert h['inout'] == 4713 # create virgin signals -cmd("halcmd newsig insig float") -cmd("halcmd newsig inoutsig float") +cmd("halcmd newsig insig real") +cmd("halcmd newsig inoutsig real") # link to them cmd("halcmd net insig linktest.in") diff --git a/tests/hal-show/expected b/tests/hal-show/expected index 7ecb4551e21..dd41b0cf1e4 100644 --- a/tests/hal-show/expected +++ b/tests/hal-show/expected @@ -1,72 +1,72 @@ Component Pins: Owner Type Dir Value Name - 10 bit IN FALSE conv-bit-u32.0.in <== net-conv-bit-u32.0.in - 16 float IN 0 conv-float-s32.0.in <== net-conv-float-s32.0.in - 19 s32 IN 0 conv-s32-float.0.in <== net-conv-s32-float.0.in - 22 s64 IN 0 conv-s64-u64.0.in <== net-conv-s64-u64.0.in - 13 u32 IN 0x00000000 conv-u32-bit.0.in <== net-conv-u32-bit.0.in - 25 u64 IN 0x0000000000000000 conv-u64-s64.0.in <== net-conv-u64-s64.0.in + 10 bool IN FALSE conv-bool-uint.0.in <== net-conv-bool-uint.0.in + 16 real IN 0 conv-real-sint.0.in <== net-conv-real-sint.0.in + 19 sint IN 0 conv-sint-real.0.in <== net-conv-sint-real.0.in + 22 sint IN 0 conv-sint-uint.0.in <== net-conv-sint-uint.0.in + 13 uint IN 0x0000000000000000 conv-uint-bool.0.in <== net-conv-uint-bool.0.in + 25 uint IN 0x0000000000000000 conv-uint-sint.0.in <== net-conv-uint-sint.0.in Signals: Type Value Name (linked to) -bit FALSE net-conv-bit-u32.0.in - ==> conv-bit-u32.0.in -u32 0x00000000 net-conv-bit-u32.0.out - <== conv-bit-u32.0.out -float 0 net-conv-float-s32.0.in - ==> conv-float-s32.0.in -s32 0 net-conv-float-s32.0.out - <== conv-float-s32.0.out -s32 0 net-conv-s32-float.0.in - ==> conv-s32-float.0.in -float 0 net-conv-s32-float.0.out - <== conv-s32-float.0.out -s64 0 net-conv-s64-u64.0.in - ==> conv-s64-u64.0.in -u64 0x0000000000000000 net-conv-s64-u64.0.out - <== conv-s64-u64.0.out -u32 0x00000000 net-conv-u32-bit.0.in - ==> conv-u32-bit.0.in -bit FALSE net-conv-u32-bit.0.out - <== conv-u32-bit.0.out -u64 0x0000000000000000 net-conv-u64-s64.0.in - ==> conv-u64-s64.0.in -s64 0 net-conv-u64-s64.0.out - <== conv-u64-s64.0.out +bool FALSE net-conv-bool-uint.0.in + ==> conv-bool-uint.0.in +uint 0x0000000000000000 net-conv-bool-uint.0.out + <== conv-bool-uint.0.out +real 0 net-conv-real-sint.0.in + ==> conv-real-sint.0.in +sint 0 net-conv-real-sint.0.out + <== conv-real-sint.0.out +sint 0 net-conv-sint-real.0.in + ==> conv-sint-real.0.in +real 0 net-conv-sint-real.0.out + <== conv-sint-real.0.out +sint 0 net-conv-sint-uint.0.in + ==> conv-sint-uint.0.in +uint 0x0000000000000000 net-conv-sint-uint.0.out + <== conv-sint-uint.0.out +uint 0x0000000000000000 net-conv-uint-bool.0.in + ==> conv-uint-bool.0.in +bool FALSE net-conv-uint-bool.0.out + <== conv-uint-bool.0.out +uint 0x0000000000000000 net-conv-uint-sint.0.in + ==> conv-uint-sint.0.in +sint 0 net-conv-uint-sint.0.out + <== conv-uint-sint.0.out Component Pins: Owner Type Dir Value Name - 10 bit IN TRUE conv-bit-u32.0.in <== net-conv-bit-u32.0.in - 16 float IN 2.147484e+09 conv-float-s32.0.in <== net-conv-float-s32.0.in - 19 s32 IN -2147483648 conv-s32-float.0.in <== net-conv-s32-float.0.in - 22 s64 IN -9223372036854775808 conv-s64-u64.0.in <== net-conv-s64-u64.0.in - 13 u32 IN 0xFFFFFFFF conv-u32-bit.0.in <== net-conv-u32-bit.0.in - 25 u64 IN 0xFFFFFFFFFFFFFFFF conv-u64-s64.0.in <== net-conv-u64-s64.0.in + 10 bool IN TRUE conv-bool-uint.0.in <== net-conv-bool-uint.0.in + 16 real IN 2.147484e+09 conv-real-sint.0.in <== net-conv-real-sint.0.in + 19 sint IN -2147483648 conv-sint-real.0.in <== net-conv-sint-real.0.in + 22 sint IN -9223372036854775808 conv-sint-uint.0.in <== net-conv-sint-uint.0.in + 13 uint IN 0x00000000FFFFFFFF conv-uint-bool.0.in <== net-conv-uint-bool.0.in + 25 uint IN 0xFFFFFFFFFFFFFFFF conv-uint-sint.0.in <== net-conv-uint-sint.0.in Signals: Type Value Name (linked to) -bit TRUE net-conv-bit-u32.0.in - ==> conv-bit-u32.0.in -u32 0x00000001 net-conv-bit-u32.0.out - <== conv-bit-u32.0.out -float 2.147484e+09 net-conv-float-s32.0.in - ==> conv-float-s32.0.in -s32 2147483647 net-conv-float-s32.0.out - <== conv-float-s32.0.out -s32 -2147483648 net-conv-s32-float.0.in - ==> conv-s32-float.0.in -float -2.147484e+09 net-conv-s32-float.0.out - <== conv-s32-float.0.out -s64 -9223372036854775808 net-conv-s64-u64.0.in - ==> conv-s64-u64.0.in -u64 0x8000000000000000 net-conv-s64-u64.0.out - <== conv-s64-u64.0.out -u32 0xFFFFFFFF net-conv-u32-bit.0.in - ==> conv-u32-bit.0.in -bit TRUE net-conv-u32-bit.0.out - <== conv-u32-bit.0.out -u64 0xFFFFFFFFFFFFFFFF net-conv-u64-s64.0.in - ==> conv-u64-s64.0.in -s64 -1 net-conv-u64-s64.0.out - <== conv-u64-s64.0.out +bool TRUE net-conv-bool-uint.0.in + ==> conv-bool-uint.0.in +uint 0x0000000000000001 net-conv-bool-uint.0.out + <== conv-bool-uint.0.out +real 2.147484e+09 net-conv-real-sint.0.in + ==> conv-real-sint.0.in +sint 2147483647 net-conv-real-sint.0.out + <== conv-real-sint.0.out +sint -2147483648 net-conv-sint-real.0.in + ==> conv-sint-real.0.in +real -2.147484e+09 net-conv-sint-real.0.out + <== conv-sint-real.0.out +sint -9223372036854775808 net-conv-sint-uint.0.in + ==> conv-sint-uint.0.in +uint 0x8000000000000000 net-conv-sint-uint.0.out + <== conv-sint-uint.0.out +uint 0x00000000FFFFFFFF net-conv-uint-bool.0.in + ==> conv-uint-bool.0.in +bool TRUE net-conv-uint-bool.0.out + <== conv-uint-bool.0.out +uint 0xFFFFFFFFFFFFFFFF net-conv-uint-sint.0.in + ==> conv-uint-sint.0.in +sint -1 net-conv-uint-sint.0.out + <== conv-uint-sint.0.out diff --git a/tests/hal-show/test.hal b/tests/hal-show/test.hal index bbc57afd9ed..3b8fa61638b 100644 --- a/tests/hal-show/test.hal +++ b/tests/hal-show/test.hal @@ -1,52 +1,46 @@ # This should print every data type as input and output loadrt threads -loadrt conv_bit_u32 count=1 -loadrt conv_u32_bit count=1 -loadrt conv_float_s32 count=1 -loadrt conv_s32_float count=1 -loadrt conv_s64_u64 count=1 -loadrt conv_u64_s64 count=1 - -addf conv-bit-u32.0 thread1 -addf conv-u32-bit.0 thread1 -addf conv-float-s32.0 thread1 -addf conv-s32-float.0 thread1 -addf conv-s64-u64.0 thread1 -addf conv-u64-s64.0 thread1 - -net net-conv-float-s32.0.in conv-float-s32.0.in -net net-conv-float-s32.0.out conv-float-s32.0.out -net net-conv-s32-float.0.in conv-s32-float.0.in -net net-conv-s32-float.0.out conv-s32-float.0.out -net net-conv-bit-u32.0.in conv-bit-u32.0.in -net net-conv-bit-u32.0.out conv-bit-u32.0.out -net net-conv-s64-u64.0.in conv-s64-u64.0.in -net net-conv-s64-u64.0.out conv-s64-u64.0.out -net net-conv-u32-bit.0.in conv-u32-bit.0.in -net net-conv-u32-bit.0.out conv-u32-bit.0.out -net net-conv-u64-s64.0.in conv-u64-s64.0.in -net net-conv-u64-s64.0.out conv-u64-s64.0.out +loadrt conv_bool_uint count=1 +loadrt conv_uint_bool count=1 +loadrt conv_real_sint count=1 +loadrt conv_sint_real count=1 +loadrt conv_sint_uint count=1 +loadrt conv_uint_sint count=1 + +addf conv-bool-uint.0 thread1 +addf conv-uint-bool.0 thread1 +addf conv-real-sint.0 thread1 +addf conv-sint-real.0 thread1 +addf conv-sint-uint.0 thread1 +addf conv-uint-sint.0 thread1 + +net net-conv-real-sint.0.in conv-real-sint.0.in +net net-conv-real-sint.0.out conv-real-sint.0.out +net net-conv-sint-real.0.in conv-sint-real.0.in +net net-conv-sint-real.0.out conv-sint-real.0.out +net net-conv-bool-uint.0.in conv-bool-uint.0.in +net net-conv-bool-uint.0.out conv-bool-uint.0.out +net net-conv-sint-uint.0.in conv-sint-uint.0.in +net net-conv-sint-uint.0.out conv-sint-uint.0.out +net net-conv-uint-bool.0.in conv-uint-bool.0.in +net net-conv-uint-bool.0.out conv-uint-bool.0.out +net net-conv-uint-sint.0.in conv-uint-sint.0.in +net net-conv-uint-sint.0.out conv-uint-sint.0.out start loadusr -w sleep 0.1 show pin *.in show sig -sets net-conv-float-s32.0.in 2147483647 -sets net-conv-s32-float.0.in -2147483648 -sets net-conv-bit-u32.0.in 1 -sets net-conv-s64-u64.0.in -9223372036854775808 -sets net-conv-u32-bit.0.in 0xffffffff -sets net-conv-u64-s64.0.in 0xffffffffffffffff +sets net-conv-real-sint.0.in 2147483647 +sets net-conv-sint-real.0.in -2147483648 +sets net-conv-bool-uint.0.in 1 +sets net-conv-sint-uint.0.in -9223372036854775808 +sets net-conv-uint-bool.0.in 0xffffffff +sets net-conv-uint-sint.0.in 0xffffffffffffffff loadusr -w sleep 0.1 show pin *.in show sig - - - - - - diff --git a/tests/halcompile/personalities_mod/4count_2pers.expected b/tests/halcompile/personalities_mod/4count_2pers.expected index 01f5bc56498..81aa9f66ad2 100644 --- a/tests/halcompile/personalities_mod/4count_2pers.expected +++ b/tests/halcompile/personalities_mod/4count_2pers.expected @@ -1,100 +1,100 @@ -bitslice_test u32 IN 0 bitslice-test.0.in -bitslice_test bit OUT FALSE bitslice-test.0.out-00 -bitslice_test bit OUT FALSE bitslice-test.0.out-01 -bitslice_test s32 OUT 0 bitslice-test.0.time -bitslice_test u32 IN 0 bitslice-test.1.in -bitslice_test bit OUT FALSE bitslice-test.1.out-00 -bitslice_test bit OUT FALSE bitslice-test.1.out-01 -bitslice_test bit OUT FALSE bitslice-test.1.out-02 -bitslice_test s32 OUT 0 bitslice-test.1.time -bitslice_test u32 IN 0 bitslice-test.2.in -bitslice_test bit OUT FALSE bitslice-test.2.out-00 -bitslice_test bit OUT FALSE bitslice-test.2.out-01 -bitslice_test s32 OUT 0 bitslice-test.2.time -bitslice_test u32 IN 0 bitslice-test.3.in -bitslice_test bit OUT FALSE bitslice-test.3.out-00 -bitslice_test bit OUT FALSE bitslice-test.3.out-01 -bitslice_test bit OUT FALSE bitslice-test.3.out-02 -bitslice_test s32 OUT 0 bitslice-test.3.time -lincurve_test float IN 0 lincurve-test.0.in -lincurve_test float OUT 0 lincurve-test.0.out -lincurve_test float I/O 0 lincurve-test.0.out-io -lincurve_test s32 OUT 0 lincurve-test.0.time -lincurve_test float IN 0 lincurve-test.1.in -lincurve_test float OUT 0 lincurve-test.1.out -lincurve_test float I/O 0 lincurve-test.1.out-io -lincurve_test s32 OUT 0 lincurve-test.1.time -lincurve_test float IN 0 lincurve-test.2.in -lincurve_test float OUT 0 lincurve-test.2.out -lincurve_test float I/O 0 lincurve-test.2.out-io -lincurve_test s32 OUT 0 lincurve-test.2.time -lincurve_test float IN 0 lincurve-test.3.in -lincurve_test float OUT 0 lincurve-test.3.out -lincurve_test float I/O 0 lincurve-test.3.out-io -lincurve_test s32 OUT 0 lincurve-test.3.time -logic_test bit OUT FALSE logic-test.0.and -logic_test bit IN FALSE logic-test.0.in-00 -logic_test bit IN FALSE logic-test.0.in-01 -logic_test s32 OUT 0 logic-test.0.time -logic_test bit IN FALSE logic-test.1.in-00 -logic_test bit IN FALSE logic-test.1.in-01 -logic_test bit IN FALSE logic-test.1.in-02 -logic_test bit IN FALSE logic-test.1.in-03 -logic_test bit OUT FALSE logic-test.1.or -logic_test s32 OUT 0 logic-test.1.time -logic_test bit OUT FALSE logic-test.2.and -logic_test bit IN FALSE logic-test.2.in-00 -logic_test bit IN FALSE logic-test.2.in-01 -logic_test s32 OUT 0 logic-test.2.time -logic_test bit IN FALSE logic-test.3.in-00 -logic_test bit IN FALSE logic-test.3.in-01 -logic_test bit IN FALSE logic-test.3.in-02 -logic_test bit IN FALSE logic-test.3.in-03 -logic_test bit OUT FALSE logic-test.3.or -logic_test s32 OUT 0 logic-test.3.time +bitslice_test uint IN 0 bitslice-test.0.in +bitslice_test bool OUT FALSE bitslice-test.0.out-00 +bitslice_test bool OUT FALSE bitslice-test.0.out-01 +bitslice_test sint OUT 0 bitslice-test.0.time +bitslice_test uint IN 0 bitslice-test.1.in +bitslice_test bool OUT FALSE bitslice-test.1.out-00 +bitslice_test bool OUT FALSE bitslice-test.1.out-01 +bitslice_test bool OUT FALSE bitslice-test.1.out-02 +bitslice_test sint OUT 0 bitslice-test.1.time +bitslice_test uint IN 0 bitslice-test.2.in +bitslice_test bool OUT FALSE bitslice-test.2.out-00 +bitslice_test bool OUT FALSE bitslice-test.2.out-01 +bitslice_test sint OUT 0 bitslice-test.2.time +bitslice_test uint IN 0 bitslice-test.3.in +bitslice_test bool OUT FALSE bitslice-test.3.out-00 +bitslice_test bool OUT FALSE bitslice-test.3.out-01 +bitslice_test bool OUT FALSE bitslice-test.3.out-02 +bitslice_test sint OUT 0 bitslice-test.3.time +lincurve_test real IN 0 lincurve-test.0.in +lincurve_test real OUT 0 lincurve-test.0.out +lincurve_test real I/O 0 lincurve-test.0.out-io +lincurve_test sint OUT 0 lincurve-test.0.time +lincurve_test real IN 0 lincurve-test.1.in +lincurve_test real OUT 0 lincurve-test.1.out +lincurve_test real I/O 0 lincurve-test.1.out-io +lincurve_test sint OUT 0 lincurve-test.1.time +lincurve_test real IN 0 lincurve-test.2.in +lincurve_test real OUT 0 lincurve-test.2.out +lincurve_test real I/O 0 lincurve-test.2.out-io +lincurve_test sint OUT 0 lincurve-test.2.time +lincurve_test real IN 0 lincurve-test.3.in +lincurve_test real OUT 0 lincurve-test.3.out +lincurve_test real I/O 0 lincurve-test.3.out-io +lincurve_test sint OUT 0 lincurve-test.3.time +logic_test bool OUT FALSE logic-test.0.and +logic_test bool IN FALSE logic-test.0.in-00 +logic_test bool IN FALSE logic-test.0.in-01 +logic_test sint OUT 0 logic-test.0.time +logic_test bool IN FALSE logic-test.1.in-00 +logic_test bool IN FALSE logic-test.1.in-01 +logic_test bool IN FALSE logic-test.1.in-02 +logic_test bool IN FALSE logic-test.1.in-03 +logic_test bool OUT FALSE logic-test.1.or +logic_test sint OUT 0 logic-test.1.time +logic_test bool OUT FALSE logic-test.2.and +logic_test bool IN FALSE logic-test.2.in-00 +logic_test bool IN FALSE logic-test.2.in-01 +logic_test sint OUT 0 logic-test.2.time +logic_test bool IN FALSE logic-test.3.in-00 +logic_test bool IN FALSE logic-test.3.in-01 +logic_test bool IN FALSE logic-test.3.in-02 +logic_test bool IN FALSE logic-test.3.in-03 +logic_test bool OUT FALSE logic-test.3.or +logic_test sint OUT 0 logic-test.3.time -bitslice_test s32 RW 0 bitslice-test.0.tmax -bitslice_test bit RO FALSE bitslice-test.0.tmax-increased -bitslice_test s32 RW 0 bitslice-test.1.tmax -bitslice_test bit RO FALSE bitslice-test.1.tmax-increased -bitslice_test s32 RW 0 bitslice-test.2.tmax -bitslice_test bit RO FALSE bitslice-test.2.tmax-increased -bitslice_test s32 RW 0 bitslice-test.3.tmax -bitslice_test bit RO FALSE bitslice-test.3.tmax-increased -lincurve_test s32 RW 0 lincurve-test.0.tmax -lincurve_test bit RO FALSE lincurve-test.0.tmax-increased -lincurve_test float RW 0 lincurve-test.0.x-val-00 -lincurve_test float RW 0 lincurve-test.0.x-val-01 -lincurve_test float RW 0 lincurve-test.0.y-val-00 -lincurve_test float RW 0 lincurve-test.0.y-val-01 -lincurve_test s32 RW 0 lincurve-test.1.tmax -lincurve_test bit RO FALSE lincurve-test.1.tmax-increased -lincurve_test float RW 0 lincurve-test.1.x-val-00 -lincurve_test float RW 0 lincurve-test.1.x-val-01 -lincurve_test float RW 0 lincurve-test.1.x-val-02 -lincurve_test float RW 0 lincurve-test.1.y-val-00 -lincurve_test float RW 0 lincurve-test.1.y-val-01 -lincurve_test float RW 0 lincurve-test.1.y-val-02 -lincurve_test s32 RW 0 lincurve-test.2.tmax -lincurve_test bit RO FALSE lincurve-test.2.tmax-increased -lincurve_test float RW 0 lincurve-test.2.x-val-00 -lincurve_test float RW 0 lincurve-test.2.x-val-01 -lincurve_test float RW 0 lincurve-test.2.y-val-00 -lincurve_test float RW 0 lincurve-test.2.y-val-01 -lincurve_test s32 RW 0 lincurve-test.3.tmax -lincurve_test bit RO FALSE lincurve-test.3.tmax-increased -lincurve_test float RW 0 lincurve-test.3.x-val-00 -lincurve_test float RW 0 lincurve-test.3.x-val-01 -lincurve_test float RW 0 lincurve-test.3.x-val-02 -lincurve_test float RW 0 lincurve-test.3.y-val-00 -lincurve_test float RW 0 lincurve-test.3.y-val-01 -lincurve_test float RW 0 lincurve-test.3.y-val-02 -logic_test s32 RW 0 logic-test.0.tmax -logic_test bit RO FALSE logic-test.0.tmax-increased -logic_test s32 RW 0 logic-test.1.tmax -logic_test bit RO FALSE logic-test.1.tmax-increased -logic_test s32 RW 0 logic-test.2.tmax -logic_test bit RO FALSE logic-test.2.tmax-increased -logic_test s32 RW 0 logic-test.3.tmax -logic_test bit RO FALSE logic-test.3.tmax-increased +bitslice_test sint RW 0 bitslice-test.0.tmax +bitslice_test bool RO FALSE bitslice-test.0.tmax-increased +bitslice_test sint RW 0 bitslice-test.1.tmax +bitslice_test bool RO FALSE bitslice-test.1.tmax-increased +bitslice_test sint RW 0 bitslice-test.2.tmax +bitslice_test bool RO FALSE bitslice-test.2.tmax-increased +bitslice_test sint RW 0 bitslice-test.3.tmax +bitslice_test bool RO FALSE bitslice-test.3.tmax-increased +lincurve_test sint RW 0 lincurve-test.0.tmax +lincurve_test bool RO FALSE lincurve-test.0.tmax-increased +lincurve_test real RW 0 lincurve-test.0.x-val-00 +lincurve_test real RW 0 lincurve-test.0.x-val-01 +lincurve_test real RW 0 lincurve-test.0.y-val-00 +lincurve_test real RW 0 lincurve-test.0.y-val-01 +lincurve_test sint RW 0 lincurve-test.1.tmax +lincurve_test bool RO FALSE lincurve-test.1.tmax-increased +lincurve_test real RW 0 lincurve-test.1.x-val-00 +lincurve_test real RW 0 lincurve-test.1.x-val-01 +lincurve_test real RW 0 lincurve-test.1.x-val-02 +lincurve_test real RW 0 lincurve-test.1.y-val-00 +lincurve_test real RW 0 lincurve-test.1.y-val-01 +lincurve_test real RW 0 lincurve-test.1.y-val-02 +lincurve_test sint RW 0 lincurve-test.2.tmax +lincurve_test bool RO FALSE lincurve-test.2.tmax-increased +lincurve_test real RW 0 lincurve-test.2.x-val-00 +lincurve_test real RW 0 lincurve-test.2.x-val-01 +lincurve_test real RW 0 lincurve-test.2.y-val-00 +lincurve_test real RW 0 lincurve-test.2.y-val-01 +lincurve_test sint RW 0 lincurve-test.3.tmax +lincurve_test bool RO FALSE lincurve-test.3.tmax-increased +lincurve_test real RW 0 lincurve-test.3.x-val-00 +lincurve_test real RW 0 lincurve-test.3.x-val-01 +lincurve_test real RW 0 lincurve-test.3.x-val-02 +lincurve_test real RW 0 lincurve-test.3.y-val-00 +lincurve_test real RW 0 lincurve-test.3.y-val-01 +lincurve_test real RW 0 lincurve-test.3.y-val-02 +logic_test sint RW 0 logic-test.0.tmax +logic_test bool RO FALSE logic-test.0.tmax-increased +logic_test sint RW 0 logic-test.1.tmax +logic_test bool RO FALSE logic-test.1.tmax-increased +logic_test sint RW 0 logic-test.2.tmax +logic_test bool RO FALSE logic-test.2.tmax-increased +logic_test sint RW 0 logic-test.3.tmax +logic_test bool RO FALSE logic-test.3.tmax-increased diff --git a/tests/halcompile/personalities_mod/4names_2pers.expected b/tests/halcompile/personalities_mod/4names_2pers.expected index 214ddaa56fc..2403c86f4e7 100644 --- a/tests/halcompile/personalities_mod/4names_2pers.expected +++ b/tests/halcompile/personalities_mod/4names_2pers.expected @@ -1,100 +1,100 @@ -bitslice_test u32 IN 0 bs1.in -bitslice_test bit OUT FALSE bs1.out-00 -bitslice_test bit OUT FALSE bs1.out-01 -bitslice_test s32 OUT 0 bs1.time -bitslice_test u32 IN 0 bs2.in -bitslice_test bit OUT FALSE bs2.out-00 -bitslice_test bit OUT FALSE bs2.out-01 -bitslice_test bit OUT FALSE bs2.out-02 -bitslice_test s32 OUT 0 bs2.time -bitslice_test u32 IN 0 bs3.in -bitslice_test bit OUT FALSE bs3.out-00 -bitslice_test bit OUT FALSE bs3.out-01 -bitslice_test s32 OUT 0 bs3.time -bitslice_test u32 IN 0 bs4.in -bitslice_test bit OUT FALSE bs4.out-00 -bitslice_test bit OUT FALSE bs4.out-01 -bitslice_test bit OUT FALSE bs4.out-02 -bitslice_test s32 OUT 0 bs4.time -lincurve_test float IN 0 lc1.in -lincurve_test float OUT 0 lc1.out -lincurve_test float I/O 0 lc1.out-io -lincurve_test s32 OUT 0 lc1.time -lincurve_test float IN 0 lc2.in -lincurve_test float OUT 0 lc2.out -lincurve_test float I/O 0 lc2.out-io -lincurve_test s32 OUT 0 lc2.time -lincurve_test float IN 0 lc3.in -lincurve_test float OUT 0 lc3.out -lincurve_test float I/O 0 lc3.out-io -lincurve_test s32 OUT 0 lc3.time -lincurve_test float IN 0 lc4.in -lincurve_test float OUT 0 lc4.out -lincurve_test float I/O 0 lc4.out-io -lincurve_test s32 OUT 0 lc4.time -logic_test bit OUT FALSE lg1.and -logic_test bit IN FALSE lg1.in-00 -logic_test bit IN FALSE lg1.in-01 -logic_test s32 OUT 0 lg1.time -logic_test bit IN FALSE lg2.in-00 -logic_test bit IN FALSE lg2.in-01 -logic_test bit IN FALSE lg2.in-02 -logic_test bit IN FALSE lg2.in-03 -logic_test bit OUT FALSE lg2.or -logic_test s32 OUT 0 lg2.time -logic_test bit OUT FALSE lg3.and -logic_test bit IN FALSE lg3.in-00 -logic_test bit IN FALSE lg3.in-01 -logic_test s32 OUT 0 lg3.time -logic_test bit IN FALSE lg4.in-00 -logic_test bit IN FALSE lg4.in-01 -logic_test bit IN FALSE lg4.in-02 -logic_test bit IN FALSE lg4.in-03 -logic_test bit OUT FALSE lg4.or -logic_test s32 OUT 0 lg4.time +bitslice_test uint IN 0 bs1.in +bitslice_test bool OUT FALSE bs1.out-00 +bitslice_test bool OUT FALSE bs1.out-01 +bitslice_test sint OUT 0 bs1.time +bitslice_test uint IN 0 bs2.in +bitslice_test bool OUT FALSE bs2.out-00 +bitslice_test bool OUT FALSE bs2.out-01 +bitslice_test bool OUT FALSE bs2.out-02 +bitslice_test sint OUT 0 bs2.time +bitslice_test uint IN 0 bs3.in +bitslice_test bool OUT FALSE bs3.out-00 +bitslice_test bool OUT FALSE bs3.out-01 +bitslice_test sint OUT 0 bs3.time +bitslice_test uint IN 0 bs4.in +bitslice_test bool OUT FALSE bs4.out-00 +bitslice_test bool OUT FALSE bs4.out-01 +bitslice_test bool OUT FALSE bs4.out-02 +bitslice_test sint OUT 0 bs4.time +lincurve_test real IN 0 lc1.in +lincurve_test real OUT 0 lc1.out +lincurve_test real I/O 0 lc1.out-io +lincurve_test sint OUT 0 lc1.time +lincurve_test real IN 0 lc2.in +lincurve_test real OUT 0 lc2.out +lincurve_test real I/O 0 lc2.out-io +lincurve_test sint OUT 0 lc2.time +lincurve_test real IN 0 lc3.in +lincurve_test real OUT 0 lc3.out +lincurve_test real I/O 0 lc3.out-io +lincurve_test sint OUT 0 lc3.time +lincurve_test real IN 0 lc4.in +lincurve_test real OUT 0 lc4.out +lincurve_test real I/O 0 lc4.out-io +lincurve_test sint OUT 0 lc4.time +logic_test bool OUT FALSE lg1.and +logic_test bool IN FALSE lg1.in-00 +logic_test bool IN FALSE lg1.in-01 +logic_test sint OUT 0 lg1.time +logic_test bool IN FALSE lg2.in-00 +logic_test bool IN FALSE lg2.in-01 +logic_test bool IN FALSE lg2.in-02 +logic_test bool IN FALSE lg2.in-03 +logic_test bool OUT FALSE lg2.or +logic_test sint OUT 0 lg2.time +logic_test bool OUT FALSE lg3.and +logic_test bool IN FALSE lg3.in-00 +logic_test bool IN FALSE lg3.in-01 +logic_test sint OUT 0 lg3.time +logic_test bool IN FALSE lg4.in-00 +logic_test bool IN FALSE lg4.in-01 +logic_test bool IN FALSE lg4.in-02 +logic_test bool IN FALSE lg4.in-03 +logic_test bool OUT FALSE lg4.or +logic_test sint OUT 0 lg4.time -bitslice_test s32 RW 0 bs1.tmax -bitslice_test bit RO FALSE bs1.tmax-increased -bitslice_test s32 RW 0 bs2.tmax -bitslice_test bit RO FALSE bs2.tmax-increased -bitslice_test s32 RW 0 bs3.tmax -bitslice_test bit RO FALSE bs3.tmax-increased -bitslice_test s32 RW 0 bs4.tmax -bitslice_test bit RO FALSE bs4.tmax-increased -lincurve_test s32 RW 0 lc1.tmax -lincurve_test bit RO FALSE lc1.tmax-increased -lincurve_test float RW 0 lc1.x-val-00 -lincurve_test float RW 0 lc1.x-val-01 -lincurve_test float RW 0 lc1.y-val-00 -lincurve_test float RW 0 lc1.y-val-01 -lincurve_test s32 RW 0 lc2.tmax -lincurve_test bit RO FALSE lc2.tmax-increased -lincurve_test float RW 0 lc2.x-val-00 -lincurve_test float RW 0 lc2.x-val-01 -lincurve_test float RW 0 lc2.x-val-02 -lincurve_test float RW 0 lc2.y-val-00 -lincurve_test float RW 0 lc2.y-val-01 -lincurve_test float RW 0 lc2.y-val-02 -lincurve_test s32 RW 0 lc3.tmax -lincurve_test bit RO FALSE lc3.tmax-increased -lincurve_test float RW 0 lc3.x-val-00 -lincurve_test float RW 0 lc3.x-val-01 -lincurve_test float RW 0 lc3.y-val-00 -lincurve_test float RW 0 lc3.y-val-01 -lincurve_test s32 RW 0 lc4.tmax -lincurve_test bit RO FALSE lc4.tmax-increased -lincurve_test float RW 0 lc4.x-val-00 -lincurve_test float RW 0 lc4.x-val-01 -lincurve_test float RW 0 lc4.x-val-02 -lincurve_test float RW 0 lc4.y-val-00 -lincurve_test float RW 0 lc4.y-val-01 -lincurve_test float RW 0 lc4.y-val-02 -logic_test s32 RW 0 lg1.tmax -logic_test bit RO FALSE lg1.tmax-increased -logic_test s32 RW 0 lg2.tmax -logic_test bit RO FALSE lg2.tmax-increased -logic_test s32 RW 0 lg3.tmax -logic_test bit RO FALSE lg3.tmax-increased -logic_test s32 RW 0 lg4.tmax -logic_test bit RO FALSE lg4.tmax-increased +bitslice_test sint RW 0 bs1.tmax +bitslice_test bool RO FALSE bs1.tmax-increased +bitslice_test sint RW 0 bs2.tmax +bitslice_test bool RO FALSE bs2.tmax-increased +bitslice_test sint RW 0 bs3.tmax +bitslice_test bool RO FALSE bs3.tmax-increased +bitslice_test sint RW 0 bs4.tmax +bitslice_test bool RO FALSE bs4.tmax-increased +lincurve_test sint RW 0 lc1.tmax +lincurve_test bool RO FALSE lc1.tmax-increased +lincurve_test real RW 0 lc1.x-val-00 +lincurve_test real RW 0 lc1.x-val-01 +lincurve_test real RW 0 lc1.y-val-00 +lincurve_test real RW 0 lc1.y-val-01 +lincurve_test sint RW 0 lc2.tmax +lincurve_test bool RO FALSE lc2.tmax-increased +lincurve_test real RW 0 lc2.x-val-00 +lincurve_test real RW 0 lc2.x-val-01 +lincurve_test real RW 0 lc2.x-val-02 +lincurve_test real RW 0 lc2.y-val-00 +lincurve_test real RW 0 lc2.y-val-01 +lincurve_test real RW 0 lc2.y-val-02 +lincurve_test sint RW 0 lc3.tmax +lincurve_test bool RO FALSE lc3.tmax-increased +lincurve_test real RW 0 lc3.x-val-00 +lincurve_test real RW 0 lc3.x-val-01 +lincurve_test real RW 0 lc3.y-val-00 +lincurve_test real RW 0 lc3.y-val-01 +lincurve_test sint RW 0 lc4.tmax +lincurve_test bool RO FALSE lc4.tmax-increased +lincurve_test real RW 0 lc4.x-val-00 +lincurve_test real RW 0 lc4.x-val-01 +lincurve_test real RW 0 lc4.x-val-02 +lincurve_test real RW 0 lc4.y-val-00 +lincurve_test real RW 0 lc4.y-val-01 +lincurve_test real RW 0 lc4.y-val-02 +logic_test sint RW 0 lg1.tmax +logic_test bool RO FALSE lg1.tmax-increased +logic_test sint RW 0 lg2.tmax +logic_test bool RO FALSE lg2.tmax-increased +logic_test sint RW 0 lg3.tmax +logic_test bool RO FALSE lg3.tmax-increased +logic_test sint RW 0 lg4.tmax +logic_test bool RO FALSE lg4.tmax-increased diff --git a/tests/halmodule.3/expected b/tests/halmodule.3/expected deleted file mode 100644 index 140572ef7d0..00000000000 --- a/tests/halmodule.3/expected +++ /dev/null @@ -1,60 +0,0 @@ -# Pins -and2.0.in0 {'haltype': 'pin', 'name': 'and2.0.in0', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-a', 'comp': 'and2', 'comp_id': 'ID'} -and2.0.in1 {'haltype': 'pin', 'name': 'and2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-b', 'comp': 'and2', 'comp_id': 'ID'} -and2.0.out {'haltype': 'pin', 'name': 'and2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-a', 'comp': 'and2', 'comp_id': 'ID'} -and2.0.time {'haltype': 'pin', 'name': 'and2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'and2', 'comp_id': 'ID'} -or2.0.in0 {'haltype': 'pin', 'name': 'or2.0.in0', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-a', 'comp': 'or2', 'comp_id': 'ID'} -or2.0.in1 {'haltype': 'pin', 'name': 'or2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-b', 'comp': 'or2', 'comp_id': 'ID'} -or2.0.out {'haltype': 'pin', 'name': 'or2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-b', 'comp': 'or2', 'comp_id': 'ID'} -or2.0.time {'haltype': 'pin', 'name': 'or2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'or2', 'comp_id': 'ID'} -testthread.threadbeat {'haltype': 'pin', 'name': 'testthread.threadbeat', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': '__testthread', 'comp_id': 'ID'} -testthread.time {'haltype': 'pin', 'name': 'testthread.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': '__testthread', 'comp_id': 'ID'} -xor2.0.in0 {'haltype': 'pin', 'name': 'xor2.0.in0', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-a', 'comp': 'xor2', 'comp_id': 'ID'} -xor2.0.in1 {'haltype': 'pin', 'name': 'xor2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-b', 'comp': 'xor2', 'comp_id': 'ID'} -xor2.0.out {'haltype': 'pin', 'name': 'xor2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-output', 'comp': 'xor2', 'comp_id': 'ID'} -xor2.0.time {'haltype': 'pin', 'name': 'xor2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'xor2', 'comp_id': 'ID'} -# Params -and2.0.tmax {'haltype': 'parameter', 'name': 'and2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'and2', 'comp_id': 'ID'} -and2.0.tmax-increased {'haltype': 'parameter', 'name': 'and2.0.tmax-increased', 'type': , 'dir': , 'value': False, 'alias': None, 'comp': 'and2', 'comp_id': 'ID'} -or2.0.tmax {'haltype': 'parameter', 'name': 'or2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'or2', 'comp_id': 'ID'} -or2.0.tmax-increased {'haltype': 'parameter', 'name': 'or2.0.tmax-increased', 'type': , 'dir': , 'value': False, 'alias': None, 'comp': 'or2', 'comp_id': 'ID'} -testthread.tmax {'haltype': 'parameter', 'name': 'testthread.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': '__testthread', 'comp_id': 'ID'} -xor2.0.tmax {'haltype': 'parameter', 'name': 'xor2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'xor2', 'comp_id': 'ID'} -xor2.0.tmax-increased {'haltype': 'parameter', 'name': 'xor2.0.tmax-increased', 'type': , 'dir': , 'value': False, 'alias': None, 'comp': 'xor2', 'comp_id': 'ID'} -# Signals -net-input-a {'haltype': 'signal', 'name': 'net-input-a', 'type': , 'value': False, 'writers': 0, 'readers': 2, 'bidirs': 0, 'driver': None} -net-input-b {'haltype': 'signal', 'name': 'net-input-b', 'type': , 'value': False, 'writers': 0, 'readers': 2, 'bidirs': 0, 'driver': None} -net-output {'haltype': 'signal', 'name': 'net-output', 'type': , 'value': False, 'writers': 1, 'readers': 0, 'bidirs': 0, 'driver': 'xor2.0.out'} -net-xor-a {'haltype': 'signal', 'name': 'net-xor-a', 'type': , 'value': False, 'writers': 1, 'readers': 1, 'bidirs': 0, 'driver': 'and2.0.out'} -net-xor-b {'haltype': 'signal', 'name': 'net-xor-b', 'type': , 'value': False, 'writers': 1, 'readers': 1, 'bidirs': 0, 'driver': 'or2.0.out'} -# Components -xor2 {'haltype': 'component', 'name': 'xor2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'} -or2 {'haltype': 'component', 'name': 'or2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'} -and2 {'haltype': 'component', 'name': 'and2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'} -__testthread {'haltype': 'component', 'name': '__testthread', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': None} -threads {'haltype': 'component', 'name': 'threads', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'name1=testthread period1=1000000'} -# Functions -and2.0 {'haltype': 'function', 'name': 'and2.0', 'comp': 'and2', 'comp_id': 'ID', 'users': 1, 'reentrant': False} -or2.0 {'haltype': 'function', 'name': 'or2.0', 'comp': 'or2', 'comp_id': 'ID', 'users': 1, 'reentrant': False} -xor2.0 {'haltype': 'function', 'name': 'xor2.0', 'comp': 'xor2', 'comp_id': 'ID', 'users': 1, 'reentrant': False} -# Threads -testthread {'haltype': 'thread', 'name': 'testthread', 'comp': '__testthread', 'comp_id': 'ID', 'priority': 0, 'period': 1000000, 'functions': [{'haltype': 'threadfunction', 'name': 'and2.0', 'index': 0, 'is_init': False}, {'haltype': 'threadfunction', 'name': 'or2.0', 'index': 1, 'is_init': False}, {'haltype': 'threadfunction', 'name': 'xor2.0', 'index': 2, 'is_init': False}]} -# Signal pins -and2.0.out {'haltype': 'pin', 'name': 'and2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-a', 'comp': 'and2', 'comp_id': 'ID'} -xor2.0.in0 {'haltype': 'pin', 'name': 'xor2.0.in0', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-a', 'comp': 'xor2', 'comp_id': 'ID'} -# Intended failures -pin('does-not-exist') fails correctly -param('does-not-exist') fails correctly -signal('does-not-exist') fails correctly -comp('does-not-exist') fails correctly -comp(65534) fails correctly -funct('does-not-exist') fails correctly -thread('does-not-exist') fails correctly -signalpins('does-not-exist') fails correctly -# Simple named queries -Pin: {'haltype': 'pin', 'name': 'or2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-b', 'comp': 'or2', 'comp_id': 'ID'} -Param: {'haltype': 'parameter', 'name': 'testthread.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': '__testthread', 'comp_id': 'ID'} -Signal: {'haltype': 'signal', 'name': 'net-output', 'type': , 'value': False, 'writers': 1, 'readers': 0, 'bidirs': 0, 'driver': 'xor2.0.out'} -Component: {'haltype': 'component', 'name': 'and2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'} -Function: {'haltype': 'function', 'name': 'xor2.0', 'comp': 'xor2', 'comp_id': 'ID', 'users': 1, 'reentrant': False} -Thread: {'haltype': 'thread', 'name': 'testthread', 'comp': '__testthread', 'comp_id': 'ID', 'priority': 0, 'period': 1000000, 'functions': [{'haltype': 'threadfunction', 'name': 'and2.0', 'index': 0, 'is_init': False}, {'haltype': 'threadfunction', 'name': 'or2.0', 'index': 1, 'is_init': False}, {'haltype': 'threadfunction', 'name': 'xor2.0', 'index': 2, 'is_init': False}]} diff --git a/tests/halmodule.0/README b/tests/halmodule/comp-set-get/README similarity index 100% rename from tests/halmodule.0/README rename to tests/halmodule/comp-set-get/README diff --git a/tests/halmodule.0/expected b/tests/halmodule/comp-set-get/expected similarity index 94% rename from tests/halmodule.0/expected rename to tests/halmodule/comp-set-get/expected index 37c7b48be8d..1d5f8e6169a 100644 --- a/tests/halmodule.0/expected +++ b/tests/halmodule/comp-set-get/expected @@ -19,10 +19,10 @@ set f 1 ok set f 1.0 ok set f 1 ok set f 89884656743115795386465259539451236680898848947115328636715040578866337902750481566354238661203768010560056939935696678829394884407208311246423715319737062188883946712432742638151109800623047059726541476042502884419075341171231440736956555270413618581675255342293149119973622969239858152417678164812112068608 ok -set s 2147483648 fail -set s -2147483649 fail +set s 2147483648 ok +set s -2147483649 ok set u -1 fail -set u 4294967296 fail +set u 4294967296 ok set f 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216 fail pincheck s True True True pincheck u True True True diff --git a/tests/halmodule.0/test.py b/tests/halmodule/comp-set-get/test.py similarity index 75% rename from tests/halmodule.0/test.py rename to tests/halmodule/comp-set-get/test.py index 59e0e83d457..5a4db102b8f 100755 --- a/tests/halmodule.0/test.py +++ b/tests/halmodule/comp-set-get/test.py @@ -4,10 +4,10 @@ h = hal.component("x") try: - ps = h.newpin("s", hal.HAL_S32, hal.HAL_OUT) - pu = h.newpin("u", hal.HAL_U32, hal.HAL_OUT) - pf = h.newpin("f", hal.HAL_FLOAT, hal.HAL_OUT) - param = h.newparam("param", hal.HAL_BIT, hal.HAL_RW) + ps = h.newpin("s", hal.Type.SINT, hal.Dir.OUT) + pu = h.newpin("u", hal.Type.UINT, hal.Dir.OUT) + pf = h.newpin("f", hal.Type.REAL, hal.Dir.OUT) + param = h.newparam("param", hal.Type.BOOL, hal.Dir.RW) h.ready() def try_set(p, v): @@ -64,27 +64,27 @@ def pin_validate(i, t, d): print("pincheck {} {} {} {}".format( i.get_name(), i.is_pin(), i.get_type() == t, i.get_dir() == d)) - pin_validate(ps, hal.HAL_S32, hal.HAL_OUT) - pin_validate(pu, hal.HAL_U32, hal.HAL_OUT) - pin_validate(pf, hal.HAL_FLOAT, hal.HAL_OUT) + pin_validate(ps, hal.Type.SINT, hal.Dir.OUT) + pin_validate(pu, hal.Type.UINT, hal.Dir.OUT) + pin_validate(pf, hal.Type.REAL, hal.Dir.OUT) pin = h.getitem("s") - pin_validate(pin, hal.HAL_S32, hal.HAL_OUT) + pin_validate(pin, hal.Type.SINT, hal.Dir.OUT) try: pin = h.getitem("not-found") print("{} {} {}".format("getitem", "not-found", "ok")) except: print("{} {} {}".format("getitem", "not-found", "fail")) - pin_validate(param, hal.HAL_BIT, hal.HAL_RW) + pin_validate(param, hal.Type.BOOL, hal.Dir.RW) param = h.getitem("param") - pin_validate(param, hal.HAL_BIT, hal.HAL_RW) + pin_validate(param, hal.Type.BOOL, hal.Dir.RW) pin = h.getpin("s") - pin_validate(pin, hal.HAL_S32, hal.HAL_OUT) + pin_validate(pin, hal.Type.SINT, hal.Dir.OUT) param = h.getparam("param") - pin_validate(param, hal.HAL_BIT, hal.HAL_RW) + pin_validate(param, hal.Type.BOOL, hal.Dir.RW) try_set_pin(pu, 0) try_set_pin(pu, -1) diff --git a/tests/halmodule.0/test.sh b/tests/halmodule/comp-set-get/test.sh similarity index 100% rename from tests/halmodule.0/test.sh rename to tests/halmodule/comp-set-get/test.sh diff --git a/tests/halmodule/deprecated/deprecated.py b/tests/halmodule/deprecated/deprecated.py new file mode 100755 index 00000000000..d19a2d81a07 --- /dev/null +++ b/tests/halmodule/deprecated/deprecated.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +import hal + +# These should all give a FutureWarning +a = hal.HAL_BIT +assert a == hal.Type.BOOL, "Bad BIT/BOOL" +a = hal.HAL_FLOAT +assert a == hal.Type.REAL, "Bad FLOAT/REAL" +a = hal.HAL_S32 +assert a == hal.Type.SINT, "Bad S32/SINT" +a = hal.HAL_U32 +assert a == hal.Type.UINT, "Bad U32/UINT" +a = hal.HAL_S64 +assert a == hal.Type.SINT, "Bad S64/SINT" +a = hal.HAL_U64 +assert a == hal.Type.UINT, "Bad U64/UINT" + diff --git a/tests/halmodule/deprecated/expected b/tests/halmodule/deprecated/expected new file mode 100644 index 00000000000..89f9c5896b8 --- /dev/null +++ b/tests/halmodule/deprecated/expected @@ -0,0 +1,12 @@ +FutureWarning: HAL_BIT has been deprecated. Please use the IntEnum type hal.Type.BOOL + a = hal.HAL_BIT +FutureWarning: HAL_FLOAT has been deprecated. Please use the IntEnum type hal.Type.REAL + a = hal.HAL_FLOAT +FutureWarning: HAL_S32 is no longer supported and replaced by hal.Type.SINT + a = hal.HAL_S32 +FutureWarning: HAL_U32 is no longer supported and replaced by hal.Type.UINT + a = hal.HAL_U32 +FutureWarning: HAL_S64 has been deprecated. Please use the IntEnum type hal.Type.SINT + a = hal.HAL_S64 +FutureWarning: HAL_U64 has been deprecated. Please use the IntEnum type hal.Type.UINT + a = hal.HAL_U64 diff --git a/tests/halmodule/deprecated/test.sh b/tests/halmodule/deprecated/test.sh new file mode 100755 index 00000000000..e75d5284c73 --- /dev/null +++ b/tests/halmodule/deprecated/test.sh @@ -0,0 +1,2 @@ +#!/bin/bash +./deprecated.py 2>&1 | sed -e's,^.*deprecated.py:[0-9]\+:\s*,,' diff --git a/tests/halmodule/halquery/expected b/tests/halmodule/halquery/expected new file mode 100644 index 00000000000..84bb9e1ef74 --- /dev/null +++ b/tests/halmodule/halquery/expected @@ -0,0 +1,60 @@ +# Pins +and2.0.in0 {'haltype': 'pin', 'name': 'and2.0.in0', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-a', 'comp': 'and2', 'comp_id': 'ID'} +and2.0.in1 {'haltype': 'pin', 'name': 'and2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-b', 'comp': 'and2', 'comp_id': 'ID'} +and2.0.out {'haltype': 'pin', 'name': 'and2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-a', 'comp': 'and2', 'comp_id': 'ID'} +and2.0.time {'haltype': 'pin', 'name': 'and2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'and2', 'comp_id': 'ID'} +or2.0.in0 {'haltype': 'pin', 'name': 'or2.0.in0', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-a', 'comp': 'or2', 'comp_id': 'ID'} +or2.0.in1 {'haltype': 'pin', 'name': 'or2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-b', 'comp': 'or2', 'comp_id': 'ID'} +or2.0.out {'haltype': 'pin', 'name': 'or2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-b', 'comp': 'or2', 'comp_id': 'ID'} +or2.0.time {'haltype': 'pin', 'name': 'or2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'or2', 'comp_id': 'ID'} +testthread.threadbeat {'haltype': 'pin', 'name': 'testthread.threadbeat', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': '__testthread', 'comp_id': 'ID'} +testthread.time {'haltype': 'pin', 'name': 'testthread.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': '__testthread', 'comp_id': 'ID'} +xor2.0.in0 {'haltype': 'pin', 'name': 'xor2.0.in0', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-a', 'comp': 'xor2', 'comp_id': 'ID'} +xor2.0.in1 {'haltype': 'pin', 'name': 'xor2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-b', 'comp': 'xor2', 'comp_id': 'ID'} +xor2.0.out {'haltype': 'pin', 'name': 'xor2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-output', 'comp': 'xor2', 'comp_id': 'ID'} +xor2.0.time {'haltype': 'pin', 'name': 'xor2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'xor2', 'comp_id': 'ID'} +# Params +and2.0.tmax {'haltype': 'parameter', 'name': 'and2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'and2', 'comp_id': 'ID'} +and2.0.tmax-increased {'haltype': 'parameter', 'name': 'and2.0.tmax-increased', 'type': , 'dir': , 'value': False, 'alias': None, 'comp': 'and2', 'comp_id': 'ID'} +or2.0.tmax {'haltype': 'parameter', 'name': 'or2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'or2', 'comp_id': 'ID'} +or2.0.tmax-increased {'haltype': 'parameter', 'name': 'or2.0.tmax-increased', 'type': , 'dir': , 'value': False, 'alias': None, 'comp': 'or2', 'comp_id': 'ID'} +testthread.tmax {'haltype': 'parameter', 'name': 'testthread.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': '__testthread', 'comp_id': 'ID'} +xor2.0.tmax {'haltype': 'parameter', 'name': 'xor2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'xor2', 'comp_id': 'ID'} +xor2.0.tmax-increased {'haltype': 'parameter', 'name': 'xor2.0.tmax-increased', 'type': , 'dir': , 'value': False, 'alias': None, 'comp': 'xor2', 'comp_id': 'ID'} +# Signals +net-input-a {'haltype': 'signal', 'name': 'net-input-a', 'type': , 'value': False, 'writers': 0, 'readers': 2, 'bidirs': 0, 'driver': None} +net-input-b {'haltype': 'signal', 'name': 'net-input-b', 'type': , 'value': False, 'writers': 0, 'readers': 2, 'bidirs': 0, 'driver': None} +net-output {'haltype': 'signal', 'name': 'net-output', 'type': , 'value': False, 'writers': 1, 'readers': 0, 'bidirs': 0, 'driver': 'xor2.0.out'} +net-xor-a {'haltype': 'signal', 'name': 'net-xor-a', 'type': , 'value': False, 'writers': 1, 'readers': 1, 'bidirs': 0, 'driver': 'and2.0.out'} +net-xor-b {'haltype': 'signal', 'name': 'net-xor-b', 'type': , 'value': False, 'writers': 1, 'readers': 1, 'bidirs': 0, 'driver': 'or2.0.out'} +# Components +xor2 {'haltype': 'component', 'name': 'xor2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'} +or2 {'haltype': 'component', 'name': 'or2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'} +and2 {'haltype': 'component', 'name': 'and2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'} +__testthread {'haltype': 'component', 'name': '__testthread', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': None} +threads {'haltype': 'component', 'name': 'threads', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'name1=testthread period1=1000000'} +# Functions +and2.0 {'haltype': 'function', 'name': 'and2.0', 'comp': 'and2', 'comp_id': 'ID', 'users': 1, 'reentrant': False} +or2.0 {'haltype': 'function', 'name': 'or2.0', 'comp': 'or2', 'comp_id': 'ID', 'users': 1, 'reentrant': False} +xor2.0 {'haltype': 'function', 'name': 'xor2.0', 'comp': 'xor2', 'comp_id': 'ID', 'users': 1, 'reentrant': False} +# Threads +testthread {'haltype': 'thread', 'name': 'testthread', 'comp': '__testthread', 'comp_id': 'ID', 'priority': 0, 'period': 1000000, 'functions': [{'haltype': 'threadfunction', 'name': 'and2.0', 'index': 0, 'is_init': False}, {'haltype': 'threadfunction', 'name': 'or2.0', 'index': 1, 'is_init': False}, {'haltype': 'threadfunction', 'name': 'xor2.0', 'index': 2, 'is_init': False}]} +# Signal pins +and2.0.out {'haltype': 'pin', 'name': 'and2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-a', 'comp': 'and2', 'comp_id': 'ID'} +xor2.0.in0 {'haltype': 'pin', 'name': 'xor2.0.in0', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-a', 'comp': 'xor2', 'comp_id': 'ID'} +# Intended failures +pin('does-not-exist') fails correctly +param('does-not-exist') fails correctly +signal('does-not-exist') fails correctly +comp('does-not-exist') fails correctly +comp(65534) fails correctly +funct('does-not-exist') fails correctly +thread('does-not-exist') fails correctly +signalpins('does-not-exist') fails correctly +# Simple named queries +Pin: {'haltype': 'pin', 'name': 'or2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-b', 'comp': 'or2', 'comp_id': 'ID'} +Param: {'haltype': 'parameter', 'name': 'testthread.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': '__testthread', 'comp_id': 'ID'} +Signal: {'haltype': 'signal', 'name': 'net-output', 'type': , 'value': False, 'writers': 1, 'readers': 0, 'bidirs': 0, 'driver': 'xor2.0.out'} +Component: {'haltype': 'component', 'name': 'and2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'} +Function: {'haltype': 'function', 'name': 'xor2.0', 'comp': 'xor2', 'comp_id': 'ID', 'users': 1, 'reentrant': False} +Thread: {'haltype': 'thread', 'name': 'testthread', 'comp': '__testthread', 'comp_id': 'ID', 'priority': 0, 'period': 1000000, 'functions': [{'haltype': 'threadfunction', 'name': 'and2.0', 'index': 0, 'is_init': False}, {'haltype': 'threadfunction', 'name': 'or2.0', 'index': 1, 'is_init': False}, {'haltype': 'threadfunction', 'name': 'xor2.0', 'index': 2, 'is_init': False}]} diff --git a/tests/halmodule.3/halquerytest.py b/tests/halmodule/halquery/halquerytest.py similarity index 90% rename from tests/halmodule.3/halquerytest.py rename to tests/halmodule/halquery/halquerytest.py index 58bec69e8bd..0025382e2dc 100755 --- a/tests/halmodule.3/halquerytest.py +++ b/tests/halmodule/halquery/halquerytest.py @@ -1,19 +1,23 @@ #!/usr/bin/env python3 import hal +import re # There is a chance that component IDs are not always consistent. They # should be, but there are no guarantees. Therefore, we simply mask the # number and use 'ID' as replacement. +def fix_enum_numbers(d): + return re.sub(r':\s*\d+>', '>', str(d)) + def fix_comp_id(d): if 'comp_id' in d: d['comp_id'] = "ID" - return d + return fix_enum_numbers(d) def fix_id(d): if 'id' in d: d['id'] = "ID" - return d + return fix_enum_numbers(d) # Call the listing query methods. print("# Pins") @@ -26,7 +30,7 @@ def fix_id(d): print("# Signals") for n,v in hal.query.signals().items(): - print(n, v) + print(n, fix_enum_numbers(v)) print("# Components") for n,v in hal.query.comps().items(): @@ -67,7 +71,7 @@ def fix_id(d): print("# Simple named queries") print("Pin:", fix_comp_id(hal.query.pin('or2.0.in1'))) print("Param:", fix_comp_id(hal.query.param('testthread.tmax'))) -print("Signal:", hal.query.signal('net-output')) +print("Signal:", fix_enum_numbers(hal.query.signal('net-output'))) print("Component:", fix_id(hal.query.comp('and2'))) print("Function:", fix_comp_id(hal.query.funct('xor2.0'))) print("Thread:", fix_comp_id(hal.query.thread('testthread'))) diff --git a/tests/halmodule.3/test.hal b/tests/halmodule/halquery/test.hal similarity index 100% rename from tests/halmodule.3/test.hal rename to tests/halmodule/halquery/test.hal diff --git a/tests/halmodule.2/expected b/tests/halmodule/no-comp-needed/expected similarity index 100% rename from tests/halmodule.2/expected rename to tests/halmodule/no-comp-needed/expected diff --git a/tests/halmodule.2/halmodtest.py b/tests/halmodule/no-comp-needed/halmodtest.py similarity index 100% rename from tests/halmodule.2/halmodtest.py rename to tests/halmodule/no-comp-needed/halmodtest.py diff --git a/tests/halmodule.2/test.hal b/tests/halmodule/no-comp-needed/test.hal similarity index 100% rename from tests/halmodule.2/test.hal rename to tests/halmodule/no-comp-needed/test.hal diff --git a/tests/halmodule.1/expected b/tests/halmodule/stream/expected similarity index 100% rename from tests/halmodule.1/expected rename to tests/halmodule/stream/expected diff --git a/tests/halmodule.1/stream_reader.py b/tests/halmodule/stream/stream_reader.py similarity index 100% rename from tests/halmodule.1/stream_reader.py rename to tests/halmodule/stream/stream_reader.py diff --git a/tests/halmodule.1/stream_test.py b/tests/halmodule/stream/stream_test.py similarity index 100% rename from tests/halmodule.1/stream_test.py rename to tests/halmodule/stream/stream_test.py diff --git a/tests/halmodule.1/stream_writer.py b/tests/halmodule/stream/stream_writer.py similarity index 100% rename from tests/halmodule.1/stream_writer.py rename to tests/halmodule/stream/stream_writer.py diff --git a/tests/halmodule.1/test.hal b/tests/halmodule/stream/test.hal similarity index 100% rename from tests/halmodule.1/test.hal rename to tests/halmodule/stream/test.hal diff --git a/tests/halui/jogging/test-ui.py b/tests/halui/jogging/test-ui.py index 858f38df542..53a61b25606 100755 --- a/tests/halui/jogging/test-ui.py +++ b/tests/halui/jogging/test-ui.py @@ -174,38 +174,38 @@ def jog_joint(joint_number, target): h = hal.component("python-ui") -h.newpin("joint-0-home", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("joint-0-homed", hal.HAL_BIT, hal.HAL_IN) -h.newpin("joint-0-select", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("joint-0-selected", hal.HAL_BIT, hal.HAL_IN) -h.newpin("joint-0-position", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("joint-0-velocity", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("joint-0-jog-plus", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("joint-0-jog-minus", hal.HAL_BIT, hal.HAL_OUT) - -h.newpin("joint-1-home", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("joint-1-homed", hal.HAL_BIT, hal.HAL_IN) -h.newpin("joint-1-select", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("joint-1-selected", hal.HAL_BIT, hal.HAL_IN) -h.newpin("joint-1-position", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("joint-1-velocity", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("joint-1-jog-plus", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("joint-1-jog-minus", hal.HAL_BIT, hal.HAL_OUT) - -h.newpin("joint-2-home", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("joint-2-homed", hal.HAL_BIT, hal.HAL_IN) -h.newpin("joint-2-select", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("joint-2-selected", hal.HAL_BIT, hal.HAL_IN) -h.newpin("joint-2-position", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("joint-2-velocity", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("joint-2-jog-plus", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("joint-2-jog-minus", hal.HAL_BIT, hal.HAL_OUT) - -h.newpin("jog-selected-minus", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("jog-selected-plus", hal.HAL_BIT, hal.HAL_OUT) - -h.newpin("motion-mode-joint", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("motion-mode-is-joint", hal.HAL_BIT, hal.HAL_IN) +h.newpin("joint-0-home", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("joint-0-homed", hal.Type.BOOL, hal.Dir.IN) +h.newpin("joint-0-select", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("joint-0-selected", hal.Type.BOOL, hal.Dir.IN) +h.newpin("joint-0-position", hal.Type.REAL, hal.Dir.IN) +h.newpin("joint-0-velocity", hal.Type.REAL, hal.Dir.IN) +h.newpin("joint-0-jog-plus", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("joint-0-jog-minus", hal.Type.BOOL, hal.Dir.OUT) + +h.newpin("joint-1-home", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("joint-1-homed", hal.Type.BOOL, hal.Dir.IN) +h.newpin("joint-1-select", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("joint-1-selected", hal.Type.BOOL, hal.Dir.IN) +h.newpin("joint-1-position", hal.Type.REAL, hal.Dir.IN) +h.newpin("joint-1-velocity", hal.Type.REAL, hal.Dir.IN) +h.newpin("joint-1-jog-plus", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("joint-1-jog-minus", hal.Type.BOOL, hal.Dir.OUT) + +h.newpin("joint-2-home", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("joint-2-homed", hal.Type.BOOL, hal.Dir.IN) +h.newpin("joint-2-select", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("joint-2-selected", hal.Type.BOOL, hal.Dir.IN) +h.newpin("joint-2-position", hal.Type.REAL, hal.Dir.IN) +h.newpin("joint-2-velocity", hal.Type.REAL, hal.Dir.IN) +h.newpin("joint-2-jog-plus", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("joint-2-jog-minus", hal.Type.BOOL, hal.Dir.OUT) + +h.newpin("jog-selected-minus", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("jog-selected-plus", hal.Type.BOOL, hal.Dir.OUT) + +h.newpin("motion-mode-joint", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("motion-mode-is-joint", hal.Type.BOOL, hal.Dir.IN) h.ready() # mark the component as 'ready' diff --git a/tests/halui/mdi/test-ui.py b/tests/halui/mdi/test-ui.py index 81afb4fd342..296db4b1d62 100755 --- a/tests/halui/mdi/test-ui.py +++ b/tests/halui/mdi/test-ui.py @@ -77,18 +77,18 @@ def wait_for_halui_mode(pin_name): h = hal.component("python-ui") -h.newpin("mdi-0", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("mdi-1", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("mdi-2", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("mdi-3", hal.HAL_BIT, hal.HAL_OUT) - -h.newpin("joint-0-position", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("joint-1-position", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("joint-2-position", hal.HAL_FLOAT, hal.HAL_IN) - -h.newpin("is-manual", hal.HAL_BIT, hal.HAL_IN) -h.newpin("is-auto", hal.HAL_BIT, hal.HAL_IN) -h.newpin("is-mdi", hal.HAL_BIT, hal.HAL_IN) +h.newpin("mdi-0", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("mdi-1", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("mdi-2", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("mdi-3", hal.Type.BOOL, hal.Dir.OUT) + +h.newpin("joint-0-position", hal.Type.REAL, hal.Dir.IN) +h.newpin("joint-1-position", hal.Type.REAL, hal.Dir.IN) +h.newpin("joint-2-position", hal.Type.REAL, hal.Dir.IN) + +h.newpin("is-manual", hal.Type.BOOL, hal.Dir.IN) +h.newpin("is-auto", hal.Type.BOOL, hal.Dir.IN) +h.newpin("is-mdi", hal.Type.BOOL, hal.Dir.IN) h.ready() # mark the component as 'ready' diff --git a/tests/hard-limits/test-ui.py b/tests/hard-limits/test-ui.py index 61b1ffab036..a43181ed4c4 100755 --- a/tests/hard-limits/test-ui.py +++ b/tests/hard-limits/test-ui.py @@ -48,7 +48,7 @@ def assert_wait_complete(command): # comp = hal.component("test-ui") -comp.newpin("x-neg-lim-sw", hal.HAL_BIT, hal.HAL_OUT) +comp.newpin("x-neg-lim-sw", hal.Type.BOOL, hal.Dir.OUT) comp.ready() hal.connect('test-ui.x-neg-lim-sw', 'x-neg-lim-sw') diff --git a/tests/io-startup/test-ui.py b/tests/io-startup/test-ui.py index d46c5a1fd6d..0ffd32d26d4 100755 --- a/tests/io-startup/test-ui.py +++ b/tests/io-startup/test-ui.py @@ -39,7 +39,7 @@ def wait_for_pin_value(pin_name, value, timeout=5.0): h = hal.component("test-ui") -h.newpin("tool-number", hal.HAL_S32, hal.HAL_IN) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) h.ready() # mark the component as 'ready' diff --git a/tests/limit3/constraints/test.hal b/tests/limit3/constraints/test.hal index c7eb9f85c68..9c886f9a12e 100644 --- a/tests/limit3/constraints/test.hal +++ b/tests/limit3/constraints/test.hal @@ -25,13 +25,13 @@ net triangle <= siggen.0.triangle loadrt mux_generic config=ff8 -net sine => mux-gen.00.in-float-00 -net cosine => mux-gen.00.in-float-01 -net square => mux-gen.00.in-float-02 -net sawtooth => mux-gen.00.in-float-03 -net triangle => mux-gen.00.in-float-04 +net sine => mux-gen.00.in-real-00 +net cosine => mux-gen.00.in-real-01 +net square => mux-gen.00.in-real-02 +net sawtooth => mux-gen.00.in-real-03 +net triangle => mux-gen.00.in-real-04 -net input <= mux-gen.00.out-float +net input <= mux-gen.00.out-real # @@ -49,7 +49,7 @@ setp limit3.0.maxa 15800 net input => limit3.0.in net output <= limit3.0.out -net output => mux-gen.00.in-float-05 +net output => mux-gen.00.in-real-05 # @@ -88,10 +88,10 @@ encoder.0.position-scale = 500 net heartbeat => encoder.0.phase-A net encoder-position <= encoder.0.position -loadrt conv_float_u32 -net encoder-position => conv-float-u32.0.in +loadrt conv_real_uint +net encoder-position => conv-real-uint.0.in -net mux-select <= conv-float-u32.0.out +net mux-select <= conv-real-uint.0.out net mux-select => mux-gen.00.sel-int @@ -113,7 +113,7 @@ loadrt threads name1=t period1=1000000 addf charge-pump t addf encoder.update-counters t addf encoder.capture-position t -addf conv-float-u32.0 t +addf conv-real-uint.0 t addf siggen.0.update t addf mux-gen.00 t diff --git a/tests/mb2hal/mb2hal.1b/expected b/tests/mb2hal/mb2hal.1b/expected index 61a45c4a4c0..2d2ead72ebe 100644 --- a/tests/mb2hal/mb2hal.1b/expected +++ b/tests/mb2hal/mb2hal.1b/expected @@ -1,39 +1,39 @@ Component Pins: Owner Type Dir Value Name - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.00 - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.01 - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.02 - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.03 + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.00 + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.01 + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.02 + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.03 Component Pins: Owner Type Dir Value Name - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.00.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.00.int - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.01.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.01.int - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.02.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.02.int - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.03.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.03.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.00.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.00.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.01.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.01.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.02.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.02.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.03.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.03.int Component Pins: Owner Type Dir Value Name - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.00 - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.01 - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.02 - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.03 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.00 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.01 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.02 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.03 Component Pins: Owner Type Dir Value Name - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.00 - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.01 - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.02 - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.03 + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.00 + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.01 + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.02 + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.03 Component Pins: Owner Type Dir Value Name - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.00 - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.01 - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.02 - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.03 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.00 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.01 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.02 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.03 diff --git a/tests/mb2hal/mb2hal.2b/expected b/tests/mb2hal/mb2hal.2b/expected index abbcbcb63f8..b2f959b0d5e 100644 --- a/tests/mb2hal/mb2hal.2b/expected +++ b/tests/mb2hal/mb2hal.2b/expected @@ -1,69 +1,69 @@ Component Pins: Owner Type Dir Value Name - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.00.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_02.00.bit-inv - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.01.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_02.01.bit-inv - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.02.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_02.02.bit-inv - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.03.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_02.03.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.00.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_02.00.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.01.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_02.01.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.02.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_02.02.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.03.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_02.03.bit-inv Component Pins: Owner Type Dir Value Name - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.00.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.00.int - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.01.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.01.int - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.02.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.02.int - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.03.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.03.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.00.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.00.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.01.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.01.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.02.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.02.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.03.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.03.int Component Pins: Owner Type Dir Value Name - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.00.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_06.00.int - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.01.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_06.01.int - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.02.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_06.02.int - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.03.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_06.03.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.00.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_06.00.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.01.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_06.01.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.02.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_06.02.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.03.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_06.03.int Component Pins: Owner Type Dir Value Name - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.00.bit - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.01.bit - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.02.bit - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.03.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.00.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.01.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.02.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.03.bit Component Pins: Owner Type Dir Value Name - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.00.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_16.00.int - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.01.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_16.01.int - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.02.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_16.02.int - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.03.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_16.03.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.00.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_16.00.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.01.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_16.01.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.02.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_16.02.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.03.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_16.03.int Component Pins: Owner Type Dir Value Name - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_01.00.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_01.00.bit-inv - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_01.01.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_01.01.bit-inv - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_01.02.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_01.02.bit-inv - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_01.03.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_01.03.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_01.00.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_01.00.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_01.01.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_01.01.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_01.02.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_01.02.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_01.03.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_01.03.bit-inv Component Pins: Owner Type Dir Value Name - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_05.00.bit - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_05.01.bit - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_05.02.bit - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_05.03.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_05.00.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_05.01.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_05.02.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_05.03.bit diff --git a/tests/mdi-queue-length/test-ui.py b/tests/mdi-queue-length/test-ui.py index 44ddaeef741..5d966f4eeac 100755 --- a/tests/mdi-queue-length/test-ui.py +++ b/tests/mdi-queue-length/test-ui.py @@ -61,11 +61,11 @@ def wait_for_mdi_queue(queue_len, timeout=10): h = hal.component("test-ui") -h.newpin("digital-poker", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("digital-poker", hal.Type.BOOL, hal.Dir.OUT) h['digital-poker'] = False h.ready() -hal.new_sig('poke', hal.HAL_BIT) +hal.new_sig('poke', hal.Type.BOOL) hal.connect('motion.digital-in-00', 'poke') hal.connect('test-ui.digital-poker', 'poke') diff --git a/tests/motion-logger/basic/test-ui.py b/tests/motion-logger/basic/test-ui.py index d1135170f67..21da4c2bd47 100755 --- a/tests/motion-logger/basic/test-ui.py +++ b/tests/motion-logger/basic/test-ui.py @@ -12,7 +12,7 @@ import re comp = hal.component("test-ui") -comp.newpin("reopen-log", hal.HAL_BIT, hal.HAL_IO) +comp.newpin("reopen-log", hal.Type.BOOL, hal.Dir.IO) comp.ready() os.system("halcmd net reopen-log test-ui.reopen-log motion-logger.reopen-log") diff --git a/tests/motion/jogwheel-axis/test-ui.py b/tests/motion/jogwheel-axis/test-ui.py index e66b3ae478c..052a8e2a6f8 100755 --- a/tests/motion/jogwheel-axis/test-ui.py +++ b/tests/motion/jogwheel-axis/test-ui.py @@ -60,20 +60,20 @@ def jog_axis(axis_letter, counts=1, scale=0.001): h = hal.component("test-ui") -h.newpin("axis-x-jog-enable", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("axis-x-jog-counts", hal.HAL_S32, hal.HAL_OUT) -h.newpin("axis-x-jog-scale", hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin("axis-x-position", hal.HAL_FLOAT, hal.HAL_IN) - -h.newpin("axis-y-jog-enable", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("axis-y-jog-counts", hal.HAL_S32, hal.HAL_OUT) -h.newpin("axis-y-jog-scale", hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin("axis-y-position", hal.HAL_FLOAT, hal.HAL_IN) - -h.newpin("axis-z-jog-enable", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("axis-z-jog-counts", hal.HAL_S32, hal.HAL_OUT) -h.newpin("axis-z-jog-scale", hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin("axis-z-position", hal.HAL_FLOAT, hal.HAL_IN) +h.newpin("axis-x-jog-enable", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("axis-x-jog-counts", hal.Type.SINT, hal.Dir.OUT) +h.newpin("axis-x-jog-scale", hal.Type.REAL, hal.Dir.OUT) +h.newpin("axis-x-position", hal.Type.REAL, hal.Dir.IN) + +h.newpin("axis-y-jog-enable", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("axis-y-jog-counts", hal.Type.SINT, hal.Dir.OUT) +h.newpin("axis-y-jog-scale", hal.Type.REAL, hal.Dir.OUT) +h.newpin("axis-y-position", hal.Type.REAL, hal.Dir.IN) + +h.newpin("axis-z-jog-enable", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("axis-z-jog-counts", hal.Type.SINT, hal.Dir.OUT) +h.newpin("axis-z-jog-scale", hal.Type.REAL, hal.Dir.OUT) +h.newpin("axis-z-position", hal.Type.REAL, hal.Dir.IN) h.ready() # mark the component as 'ready' diff --git a/tests/motion/jogwheel-joint/test-ui.py b/tests/motion/jogwheel-joint/test-ui.py index 076f659d5df..9ac0d33a104 100755 --- a/tests/motion/jogwheel-joint/test-ui.py +++ b/tests/motion/jogwheel-joint/test-ui.py @@ -75,20 +75,20 @@ def jog_joint(joint_number, counts=1, scale=0.001): h = hal.component("test-ui") -h.newpin("joint-0-jog-enable", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("joint-0-jog-counts", hal.HAL_S32, hal.HAL_OUT) -h.newpin("joint-0-jog-scale", hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin("joint-0-position", hal.HAL_FLOAT, hal.HAL_IN) - -h.newpin("joint-1-jog-enable", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("joint-1-jog-counts", hal.HAL_S32, hal.HAL_OUT) -h.newpin("joint-1-jog-scale", hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin("joint-1-position", hal.HAL_FLOAT, hal.HAL_IN) - -h.newpin("joint-2-jog-enable", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("joint-2-jog-counts", hal.HAL_S32, hal.HAL_OUT) -h.newpin("joint-2-jog-scale", hal.HAL_FLOAT, hal.HAL_OUT) -h.newpin("joint-2-position", hal.HAL_FLOAT, hal.HAL_IN) +h.newpin("joint-0-jog-enable", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("joint-0-jog-counts", hal.Type.SINT, hal.Dir.OUT) +h.newpin("joint-0-jog-scale", hal.Type.REAL, hal.Dir.OUT) +h.newpin("joint-0-position", hal.Type.REAL, hal.Dir.IN) + +h.newpin("joint-1-jog-enable", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("joint-1-jog-counts", hal.Type.SINT, hal.Dir.OUT) +h.newpin("joint-1-jog-scale", hal.Type.REAL, hal.Dir.OUT) +h.newpin("joint-1-position", hal.Type.REAL, hal.Dir.IN) + +h.newpin("joint-2-jog-enable", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("joint-2-jog-counts", hal.Type.SINT, hal.Dir.OUT) +h.newpin("joint-2-jog-scale", hal.Type.REAL, hal.Dir.OUT) +h.newpin("joint-2-position", hal.Type.REAL, hal.Dir.IN) h.ready() # mark the component as 'ready' diff --git a/tests/mux/expected b/tests/mux/expected index 5b8ef33feec..4403fedcd37 100644 --- a/tests/mux/expected +++ b/tests/mux/expected @@ -19,25 +19,25 @@ 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 0 1.110000 0 0 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 0 1.110000 0 0 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 0 1.110000 0 0 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 1 3.330000 0 2 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 1 3.330000 0 2 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 1 3.330000 0 2 @@ -58,21 +58,21 @@ 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 0 3.330000 0 2 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 0 3.330000 0 2 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 0 3.330000 0 2 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 1 5.550000 0 4 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 1 5.550000 0 4 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 1 5.550000 0 4 diff --git a/tests/mux/test.hal b/tests/mux/test.hal index ee1c4e18b93..5cd72d1d369 100644 --- a/tests/mux/test.hal +++ b/tests/mux/test.hal @@ -25,20 +25,20 @@ addf mux-gen.16 slow addf mux-gen.17 slow addf sampler.0 slow -net v0 mux-gen.00.in-bit-00 mux-gen.01.in-bit-00 mux-gen.02.in-bit-00 mux-gen.03.in-bit-00 mux-gen.16.in-bit-00 -net v1 mux-gen.04.in-float-00 mux-gen.05.in-float-00 mux-gen.06.in-float-00 mux-gen.07.in-float-00 -net v2 mux-gen.08.in-s32-00 mux-gen.09.in-s32-00 mux-gen.10.in-s32-00 mux-gen.11.in-s32-00 -net v3 mux-gen.12.in-u32-00 mux-gen.13.in-u32-00 mux-gen.14.in-u32-00 mux-gen.15.in-u32-00 +net v0 mux-gen.00.in-bool-00 mux-gen.01.in-bool-00 mux-gen.02.in-bool-00 mux-gen.03.in-bool-00 mux-gen.16.in-bool-00 +net v1 mux-gen.04.in-real-00 mux-gen.05.in-real-00 mux-gen.06.in-real-00 mux-gen.07.in-real-00 +net v2 mux-gen.08.in-sint-00 mux-gen.09.in-sint-00 mux-gen.10.in-sint-00 mux-gen.11.in-sint-00 +net v3 mux-gen.12.in-uint-00 mux-gen.13.in-uint-00 mux-gen.14.in-uint-00 mux-gen.15.in-uint-00 -net v4 mux-gen.00.in-bit-01 mux-gen.01.in-bit-01 mux-gen.02.in-bit-01 mux-gen.03.in-bit-01 mux-gen.16.in-bit-01 -net v5 mux-gen.04.in-float-01 mux-gen.05.in-float-01 mux-gen.06.in-float-01 mux-gen.07.in-float-01 -net v6 mux-gen.08.in-s32-01 mux-gen.09.in-s32-01 mux-gen.10.in-s32-01 mux-gen.11.in-s32-01 -net v7 mux-gen.12.in-u32-01 mux-gen.13.in-u32-01 mux-gen.14.in-u32-01 mux-gen.15.in-u32-01 +net v4 mux-gen.00.in-bool-01 mux-gen.01.in-bool-01 mux-gen.02.in-bool-01 mux-gen.03.in-bool-01 mux-gen.16.in-bool-01 +net v5 mux-gen.04.in-real-01 mux-gen.05.in-real-01 mux-gen.06.in-real-01 mux-gen.07.in-real-01 +net v6 mux-gen.08.in-sint-01 mux-gen.09.in-sint-01 mux-gen.10.in-sint-01 mux-gen.11.in-sint-01 +net v7 mux-gen.12.in-uint-01 mux-gen.13.in-uint-01 mux-gen.14.in-uint-01 mux-gen.15.in-uint-01 -net sel mux-gen.00.sel-bit-00 mux-gen.01.sel-bit-00 mux-gen.02.sel-bit-00 mux-gen.03.sel-bit-00 -net sel mux-gen.04.sel-bit-00 mux-gen.05.sel-bit-00 mux-gen.06.sel-bit-00 mux-gen.07.sel-bit-00 -net sel mux-gen.08.sel-bit-00 mux-gen.09.sel-bit-00 mux-gen.10.sel-bit-00 mux-gen.11.sel-bit-00 -net sel mux-gen.12.sel-bit-00 mux-gen.13.sel-bit-00 mux-gen.14.sel-bit-00 mux-gen.15.sel-bit-00 +net sel mux-gen.00.sel-bit-00 mux-gen.01.sel-bit-00 mux-gen.02.sel-bit-00 mux-gen.03.sel-bit-00 +net sel mux-gen.04.sel-bit-00 mux-gen.05.sel-bit-00 mux-gen.06.sel-bit-00 mux-gen.07.sel-bit-00 +net sel mux-gen.08.sel-bit-00 mux-gen.09.sel-bit-00 mux-gen.10.sel-bit-00 mux-gen.11.sel-bit-00 +net sel mux-gen.12.sel-bit-00 mux-gen.13.sel-bit-00 mux-gen.14.sel-bit-00 mux-gen.15.sel-bit-00 net sel mux-gen.16.sel-bit-00 sets v0 0 @@ -52,33 +52,33 @@ sets v7 0xFFFFFFFF setp mux-gen.16.debounce-us 4000 -setp mux-gen.17.in-float-00 1.11 -setp mux-gen.17.in-float-01 2.22 -setp mux-gen.17.in-float-02 3.33 -setp mux-gen.17.in-float-03 4.44 -setp mux-gen.17.in-float-04 5.55 +setp mux-gen.17.in-real-00 1.11 +setp mux-gen.17.in-real-01 2.22 +setp mux-gen.17.in-real-02 3.33 +setp mux-gen.17.in-real-03 4.44 +setp mux-gen.17.in-real-04 5.55 net sel streamer.0.pin.0 sampler.0.pin.18 net u streamer.0.pin.1 sampler.0.pin.19 mux-gen.17.sel-int -net o0 mux-gen.00.out-bit sampler.0.pin.0 -net o1 mux-gen.01.out-float sampler.0.pin.1 -net o2 mux-gen.02.out-s32 sampler.0.pin.2 -net o3 mux-gen.03.out-u32 sampler.0.pin.3 -net o4 mux-gen.04.out-bit sampler.0.pin.4 -net o5 mux-gen.05.out-float sampler.0.pin.5 -net o6 mux-gen.06.out-s32 sampler.0.pin.6 -net o7 mux-gen.07.out-u32 sampler.0.pin.7 -net o8 mux-gen.08.out-bit sampler.0.pin.8 -net o9 mux-gen.09.out-float sampler.0.pin.9 -net o10 mux-gen.10.out-s32 sampler.0.pin.10 -net o11 mux-gen.11.out-u32 sampler.0.pin.11 -net o12 mux-gen.12.out-bit sampler.0.pin.12 -net o13 mux-gen.13.out-float sampler.0.pin.13 -net o14 mux-gen.14.out-s32 sampler.0.pin.14 -net o15 mux-gen.15.out-u32 sampler.0.pin.15 -net o16 mux-gen.16.out-bit sampler.0.pin.16 -net o17 mux-gen.17.out-float sampler.0.pin.17 +net o0 mux-gen.00.out-bool sampler.0.pin.0 +net o1 mux-gen.01.out-real sampler.0.pin.1 +net o2 mux-gen.02.out-sint sampler.0.pin.2 +net o3 mux-gen.03.out-uint sampler.0.pin.3 +net o4 mux-gen.04.out-bool sampler.0.pin.4 +net o5 mux-gen.05.out-real sampler.0.pin.5 +net o6 mux-gen.06.out-sint sampler.0.pin.6 +net o7 mux-gen.07.out-uint sampler.0.pin.7 +net o8 mux-gen.08.out-bool sampler.0.pin.8 +net o9 mux-gen.09.out-real sampler.0.pin.9 +net o10 mux-gen.10.out-sint sampler.0.pin.10 +net o11 mux-gen.11.out-uint sampler.0.pin.11 +net o12 mux-gen.12.out-bool sampler.0.pin.12 +net o13 mux-gen.13.out-real sampler.0.pin.13 +net o14 mux-gen.14.out-sint sampler.0.pin.14 +net o15 mux-gen.15.out-uint sampler.0.pin.15 +net o16 mux-gen.16.out-bool sampler.0.pin.16 +net o17 mux-gen.17.out-real sampler.0.pin.17 loadusr halstreamer input-signals loadusr -w sleep 0.5 diff --git a/tests/pyvcp/expected b/tests/pyvcp/expected index fcbcdb67b5f..b8dd870993d 100644 --- a/tests/pyvcp/expected +++ b/tests/pyvcp/expected @@ -1,24 +1,24 @@ -mypanel float OUT 0 mypanel.dial-a-out -mypanel float OUT 0 mypanel.dial-b-out -mypanel float IN 0 mypanel.dial-c-in -mypanel float OUT 0 mypanel.dial-c-out -mypanel float OUT 0 mypanel.dial.0.out -mypanel float IN 0 mypanel.dial.0.param_pin -mypanel float IN 0 mypanel.dial.1.param_pin -mypanel float IN 0 mypanel.dial.2.param_pin -mypanel float OUT 0 mypanel.scale-a-out-f -mypanel s32 OUT 0 mypanel.scale-a-out-i -mypanel float OUT 0 mypanel.scale-b-out-f -mypanel s32 OUT 0 mypanel.scale-b-out-i -mypanel float IN 0 mypanel.scale-c-in -mypanel float OUT 0 mypanel.scale-c-out-f -mypanel s32 OUT 0 mypanel.scale-c-out-i -mypanel float OUT 0 mypanel.scale.0-f -mypanel s32 OUT 0 mypanel.scale.0-i -mypanel float IN 0 mypanel.scale.2.param_pin -mypanel float OUT 0 mypanel.spinbox-a-out -mypanel float OUT 0 mypanel.spinbox-b-out -mypanel float IN 0 mypanel.spinbox-c-in -mypanel float OUT 0 mypanel.spinbox-c-out -mypanel float OUT 0 mypanel.spinbox.0 -mypanel float IN 0 mypanel.spinbox.2.param_pin +mypanel real OUT 0 mypanel.dial-a-out +mypanel real OUT 0 mypanel.dial-b-out +mypanel real IN 0 mypanel.dial-c-in +mypanel real OUT 0 mypanel.dial-c-out +mypanel real OUT 0 mypanel.dial.0.out +mypanel real IN 0 mypanel.dial.0.param_pin +mypanel real IN 0 mypanel.dial.1.param_pin +mypanel real IN 0 mypanel.dial.2.param_pin +mypanel real OUT 0 mypanel.scale-a-out-f +mypanel sint OUT 0 mypanel.scale-a-out-i +mypanel real OUT 0 mypanel.scale-b-out-f +mypanel sint OUT 0 mypanel.scale-b-out-i +mypanel real IN 0 mypanel.scale-c-in +mypanel real OUT 0 mypanel.scale-c-out-f +mypanel sint OUT 0 mypanel.scale-c-out-i +mypanel real OUT 0 mypanel.scale.0-f +mypanel sint OUT 0 mypanel.scale.0-i +mypanel real IN 0 mypanel.scale.2.param_pin +mypanel real OUT 0 mypanel.spinbox-a-out +mypanel real OUT 0 mypanel.spinbox-b-out +mypanel real IN 0 mypanel.spinbox-c-in +mypanel real OUT 0 mypanel.spinbox-c-out +mypanel real OUT 0 mypanel.spinbox.0 +mypanel real IN 0 mypanel.spinbox.2.param_pin diff --git a/tests/raster/rastertest.py b/tests/raster/rastertest.py index 31cf8978490..9ab7ce83e97 100755 --- a/tests/raster/rastertest.py +++ b/tests/raster/rastertest.py @@ -188,22 +188,22 @@ def main(): c = hal.component("test") pin = { - 'reset': c.newpin("reset", hal.HAL_BIT, hal.HAL_OUT), - 'enabled': c.newpin("enabled", hal.HAL_BIT, hal.HAL_IN), - 'position': c.newpin("position", hal.HAL_FLOAT, hal.HAL_OUT), - 'output': c.newpin("output", hal.HAL_FLOAT, hal.HAL_IN), - 'offset': c.newpin("offset", hal.HAL_FLOAT, hal.HAL_IN), - 'bpp': c.newpin("bpp", hal.HAL_S32, hal.HAL_IN), - 'ppu': c.newpin("ppu", hal.HAL_FLOAT, hal.HAL_IN), - 'count': c.newpin("count", hal.HAL_S32, hal.HAL_IN), - 'fault': c.newpin("fault", hal.HAL_BIT, hal.HAL_IN), - 'fault_code': c.newpin("fault-code", hal.HAL_S32, hal.HAL_IN), - 'state': c.newpin("state", hal.HAL_S32, hal.HAL_IN), - 'bitmap_position': c.newpin("bitmap-position", hal.HAL_FLOAT, hal.HAL_IN), - 'current_pixel_index': c.newpin("current-pixel-index", hal.HAL_S32, hal.HAL_IN), - 'current_pixel_value': c.newpin("current-pixel-value", hal.HAL_FLOAT, hal.HAL_IN), - 'previous_pixel_value': c.newpin("previous-pixel-value", hal.HAL_FLOAT, hal.HAL_IN), - 'fraction': c.newpin("fraction", hal.HAL_FLOAT, hal.HAL_IN), + 'reset': c.newpin("reset", hal.Type.BOOL, hal.Dir.OUT), + 'enabled': c.newpin("enabled", hal.Type.BOOL, hal.Dir.IN), + 'position': c.newpin("position", hal.Type.REAL, hal.Dir.OUT), + 'output': c.newpin("output", hal.Type.REAL, hal.Dir.IN), + 'offset': c.newpin("offset", hal.Type.REAL, hal.Dir.IN), + 'bpp': c.newpin("bpp", hal.Type.SINT, hal.Dir.IN), + 'ppu': c.newpin("ppu", hal.Type.REAL, hal.Dir.IN), + 'count': c.newpin("count", hal.Type.SINT, hal.Dir.IN), + 'fault': c.newpin("fault", hal.Type.BOOL, hal.Dir.IN), + 'fault_code': c.newpin("fault-code", hal.Type.SINT, hal.Dir.IN), + 'state': c.newpin("state", hal.Type.SINT, hal.Dir.IN), + 'bitmap_position': c.newpin("bitmap-position", hal.Type.REAL, hal.Dir.IN), + 'current_pixel_index': c.newpin("current-pixel-index", hal.Type.SINT, hal.Dir.IN), + 'current_pixel_value': c.newpin("current-pixel-value", hal.Type.REAL, hal.Dir.IN), + 'previous_pixel_value': c.newpin("previous-pixel-value", hal.Type.REAL, hal.Dir.IN), + 'fraction': c.newpin("fraction", hal.Type.REAL, hal.Dir.IN), } c.ready() diff --git a/tests/remap/remap-io/test-ui.py b/tests/remap/remap-io/test-ui.py index 65640490d6f..c96923b1124 100755 --- a/tests/remap/remap-io/test-ui.py +++ b/tests/remap/remap-io/test-ui.py @@ -5,10 +5,10 @@ # Set up pins h = hal.component("test-ui") -h.newpin('d_out', hal.HAL_BIT, hal.HAL_IN) # pin for reading digital out -h.newpin('a_out', hal.HAL_FLOAT, hal.HAL_IN) # pin for reading analog out -h.newpin('d_in', hal.HAL_BIT, hal.HAL_OUT) # pin for setting digital in -h.newpin('a_in', hal.HAL_FLOAT, hal.HAL_OUT) # pin for setting analog in +h.newpin('d_out', hal.Type.BOOL, hal.Dir.IN) # pin for reading digital out +h.newpin('a_out', hal.Type.REAL, hal.Dir.IN) # pin for reading analog out +h.newpin('d_in', hal.Type.BOOL, hal.Dir.OUT) # pin for setting digital in +h.newpin('a_in', hal.Type.REAL, hal.Dir.OUT) # pin for setting analog in h.ready() # mark the component as 'ready' os.system('halcmd source postgui.hal') # Net above pins to motion I/O pins diff --git a/tests/save.0/expected b/tests/save.0/expected index 833c015c198..6b849eb5e0c 100644 --- a/tests/save.0/expected +++ b/tests/save.0/expected @@ -6,20 +6,20 @@ loadrt sampler cfg=bb depth=4096 # pin aliases # param aliases # signals -newsig unlinked bit +newsig unlinked bool # nets net dir stepgen.0.dir => sampler.0.pin.0 net step stepgen.0.step => sampler.0.pin.1 # parameter values setp fast.tmax 0 setp sampler.0.tmax 0 -setp stepgen.0.dirhold 0x00000001 -setp stepgen.0.dirsetup 0x00000001 +setp stepgen.0.dirhold 0x0000000000000001 +setp stepgen.0.dirsetup 0x0000000000000001 setp stepgen.0.maxaccel 2 setp stepgen.0.maxvel 0.15 setp stepgen.0.position-scale 32000 -setp stepgen.0.steplen 0x00000001 -setp stepgen.0.stepspace 0x00000001 +setp stepgen.0.steplen 0x0000000000000001 +setp stepgen.0.stepspace 0x0000000000000001 setp stepgen.capture-position.tmax 0 setp stepgen.make-pulses.tmax 0 setp stepgen.update-freq.tmax 0 diff --git a/tests/single-step/test-ui.py b/tests/single-step/test-ui.py index aaac15a8f93..00855f3ff7b 100755 --- a/tests/single-step/test-ui.py +++ b/tests/single-step/test-ui.py @@ -21,10 +21,10 @@ # Create and connect test feedback comp # h = hal.component("test-ui") -h.newpin("Xpos", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("Ypos", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("Zpos", hal.HAL_FLOAT, hal.HAL_IN) -h.newpin("counter", hal.HAL_FLOAT, hal.HAL_IN) +h.newpin("Xpos", hal.Type.REAL, hal.Dir.IN) +h.newpin("Ypos", hal.Type.REAL, hal.Dir.IN) +h.newpin("Zpos", hal.Type.REAL, hal.Dir.IN) +h.newpin("counter", hal.Type.REAL, hal.Dir.IN) h.ready() os.system("halcmd source ./postgui.hal") diff --git a/tests/tlo/test-ui.py b/tests/tlo/test-ui.py index c6c1f5e0402..42fe9390895 100755 --- a/tests/tlo/test-ui.py +++ b/tests/tlo/test-ui.py @@ -114,7 +114,7 @@ def verify_tool(tool, x, y, z, a, b, c, u, v, w, diameter, front_angle, back_ang h = hal.component("python-ui") -h.newpin("tool-number", hal.HAL_S32, hal.HAL_IN) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) h.ready() # mark the component as 'ready' diff --git a/tests/tool-info/non-random/test-ui.py b/tests/tool-info/non-random/test-ui.py index 137ad78c606..917cfaac0f9 100755 --- a/tests/tool-info/non-random/test-ui.py +++ b/tests/tool-info/non-random/test-ui.py @@ -127,13 +127,13 @@ def wait_for_hal_pin(pin_name, value, timeout=10): h = hal.component("test-ui") -h.newpin("tool-number", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prep-number", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prep-pocket", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prepare", hal.HAL_BIT, hal.HAL_IN) -h.newpin("tool-prepared", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("tool-change", hal.HAL_BIT, hal.HAL_IN) -h.newpin("tool-changed", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-pocket", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prepare", hal.Type.BOOL, hal.Dir.IN) +h.newpin("tool-prepared", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("tool-change", hal.Type.BOOL, hal.Dir.IN) +h.newpin("tool-changed", hal.Type.BOOL, hal.Dir.OUT) h['tool-prepared'] = False h['tool-changed'] = False h.ready() diff --git a/tests/tool-info/random-no-startup-tool/test-ui.py b/tests/tool-info/random-no-startup-tool/test-ui.py index 62fe5707ad3..4f4f0a25af5 100755 --- a/tests/tool-info/random-no-startup-tool/test-ui.py +++ b/tests/tool-info/random-no-startup-tool/test-ui.py @@ -127,13 +127,13 @@ def wait_for_hal_pin(pin_name, value, timeout=10): h = hal.component("test-ui") -h.newpin("tool-number", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prep-number", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prep-pocket", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prepare", hal.HAL_BIT, hal.HAL_IN) -h.newpin("tool-prepared", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("tool-change", hal.HAL_BIT, hal.HAL_IN) -h.newpin("tool-changed", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-pocket", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prepare", hal.Type.BOOL, hal.Dir.IN) +h.newpin("tool-prepared", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("tool-change", hal.Type.BOOL, hal.Dir.IN) +h.newpin("tool-changed", hal.Type.BOOL, hal.Dir.OUT) h['tool-prepared'] = False h['tool-changed'] = False h.ready() diff --git a/tests/tool-info/random-with-startup-tool/test-ui.py b/tests/tool-info/random-with-startup-tool/test-ui.py index 1f373cd327d..af906bf82b5 100755 --- a/tests/tool-info/random-with-startup-tool/test-ui.py +++ b/tests/tool-info/random-with-startup-tool/test-ui.py @@ -127,13 +127,13 @@ def wait_for_hal_pin(pin_name, value, timeout=10): h = hal.component("test-ui") -h.newpin("tool-number", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prep-number", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prep-pocket", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prepare", hal.HAL_BIT, hal.HAL_IN) -h.newpin("tool-prepared", hal.HAL_BIT, hal.HAL_OUT) -h.newpin("tool-change", hal.HAL_BIT, hal.HAL_IN) -h.newpin("tool-changed", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-pocket", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prepare", hal.Type.BOOL, hal.Dir.IN) +h.newpin("tool-prepared", hal.Type.BOOL, hal.Dir.OUT) +h.newpin("tool-change", hal.Type.BOOL, hal.Dir.IN) +h.newpin("tool-changed", hal.Type.BOOL, hal.Dir.OUT) h['tool-prepared'] = False h['tool-changed'] = False h.ready() diff --git a/tests/toolchanger/m61/test-ui.py b/tests/toolchanger/m61/test-ui.py index ca29beb5d6e..025cc58a36d 100755 --- a/tests/toolchanger/m61/test-ui.py +++ b/tests/toolchanger/m61/test-ui.py @@ -125,16 +125,16 @@ def do_tool_change_handshake(tool_number, pocket_number): h = hal.component("python-ui") -h.newpin("tool-number", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prep-number", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prep-pocket", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-from-pocket", hal.HAL_S32, hal.HAL_IN) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-pocket", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-from-pocket", hal.Type.SINT, hal.Dir.IN) -h.newpin("tool-prepare", hal.HAL_BIT, hal.HAL_IN) -h.newpin("tool-prepared", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("tool-prepare", hal.Type.BOOL, hal.Dir.IN) +h.newpin("tool-prepared", hal.Type.BOOL, hal.Dir.OUT) -h.newpin("tool-change", hal.HAL_BIT, hal.HAL_IN) -h.newpin("tool-changed", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("tool-change", hal.Type.BOOL, hal.Dir.IN) +h.newpin("tool-changed", hal.Type.BOOL, hal.Dir.OUT) h.ready() # mark the component as 'ready' diff --git a/tests/toolchanger/reload-tool/non-random/test-ui.py b/tests/toolchanger/reload-tool/non-random/test-ui.py index 7bff305516f..fca46c3e9f6 100755 --- a/tests/toolchanger/reload-tool/non-random/test-ui.py +++ b/tests/toolchanger/reload-tool/non-random/test-ui.py @@ -39,18 +39,18 @@ def wait_for_hal_pin(name, value, timeout=10): h = hal.component("test-ui") -h.newpin("tool-change", hal.HAL_BIT, hal.HAL_IN) -h.newpin("tool-changed", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("tool-change", hal.Type.BOOL, hal.Dir.IN) +h.newpin("tool-changed", hal.Type.BOOL, hal.Dir.OUT) h["tool-changed"] = False -h.newpin("tool-prepare", hal.HAL_BIT, hal.HAL_IN) -h.newpin("tool-prepared", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("tool-prepare", hal.Type.BOOL, hal.Dir.IN) +h.newpin("tool-prepared", hal.Type.BOOL, hal.Dir.OUT) h["tool-prepared"] = False -h.newpin("tool-number", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prep-number", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prep-pocket", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-from-pocket", hal.HAL_S32, hal.HAL_IN) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-pocket", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-from-pocket", hal.Type.SINT, hal.Dir.IN) h.ready() diff --git a/tests/toolchanger/reload-tool/random/test-ui.py b/tests/toolchanger/reload-tool/random/test-ui.py index 7e5fc520eca..22509af932d 100755 --- a/tests/toolchanger/reload-tool/random/test-ui.py +++ b/tests/toolchanger/reload-tool/random/test-ui.py @@ -39,18 +39,18 @@ def wait_for_hal_pin(name, value, timeout=10): h = hal.component("test-ui") -h.newpin("tool-change", hal.HAL_BIT, hal.HAL_IN) -h.newpin("tool-changed", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("tool-change", hal.Type.BOOL, hal.Dir.IN) +h.newpin("tool-changed", hal.Type.BOOL, hal.Dir.OUT) h["tool-changed"] = False -h.newpin("tool-prepare", hal.HAL_BIT, hal.HAL_IN) -h.newpin("tool-prepared", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("tool-prepare", hal.Type.BOOL, hal.Dir.IN) +h.newpin("tool-prepared", hal.Type.BOOL, hal.Dir.OUT) h["tool-prepared"] = False -h.newpin("tool-number", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prep-number", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prep-pocket", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-from-pocket", hal.HAL_S32, hal.HAL_IN) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-pocket", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-from-pocket", hal.Type.SINT, hal.Dir.IN) h.ready()