diff --git a/docs/po4a.cfg b/docs/po4a.cfg index 0193f140fd2..fea7dc199ab 100644 --- a/docs/po4a.cfg +++ b/docs/po4a.cfg @@ -413,6 +413,7 @@ [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 diff --git a/docs/src/getting-started/updating-linuxcnc.adoc b/docs/src/getting-started/updating-linuxcnc.adoc index d0f8caa5ac8..893075cdc3c 100644 --- a/docs/src/getting-started/updating-linuxcnc.adoc +++ b/docs/src/getting-started/updating-linuxcnc.adoc @@ -13,28 +13,32 @@ updates. If you don't have an internet connection to your PC see == Upgrade to the new version -This section describes how to upgrade LinuxCNC from version 2.8.x to a 2.9.y version. -It assumes that you have an existing 2.8 install that you want to update. +This section describes how to upgrade LinuxCNC from version 2.9.x to a 2.10.y version. +It assumes that you have an existing 2.9 install that you want to update. -To upgrade LinuxCNC from a version older than 2.8, you have to first -https://linuxcnc.org/docs/2.8/html/getting-started/updating-linuxcnc.html[upgrade your old install to 2.8], +To upgrade LinuxCNC from a version older than 2.9, you have to first +https://linuxcnc.org/docs/2.9/html/getting-started/updating-linuxcnc.html[upgrade your old install to 2.9], then follow these instructions to upgrade to the new version. If you do not have an old version of LinuxCNC to upgrade, then you're best off making a fresh install of the new version as described in the section <>. -Furthermore, if you are running Ubuntu Precise, Debian Wheezy or Debian Buster it is -well worth considering making a backup of the "linuxcnc" directory on -removable media and performing a +Furthermore, if you are running Ubuntu Precise, Debian Wheezy, Debian Buster or +Debian Bullseye it is well worth considering making a backup of the "linuxcnc" +directory on removable media and performing a <> -as these releases were EOL in 2017, 2018 and 2022 respectively. +as these releases were EOL in 2017, 2018, 2022 and 2026 respectively. If you are running on Ubuntu Lucid then you will have to do this, as Lucid is no longer supported by LinuxCNC (it was EOL in 2013). -To upgrade major versions like 2.8 to 2.9 when you have a network connection at +If you are running Debian Bookworm, then we *strongly* recommend that you upgrade to Debian Trixie. +Moving to the latest Debian version allows for better compatibility and a longer stable path for your installation. +Debian Trixie will have LTS support until June 2030. + +To upgrade major versions like 2.9 to 2.10 when you have a network connection at the machine you need to disable the old linuxcnc.org apt sources in the file /etc/apt/sources.list -and add a new linuxcnc.org apt source for 2.9, then upgrade LinuxCNC. +and add a new linuxcnc.org apt source for 2.10, then upgrade LinuxCNC. The details will depend on which platform you're running on. Open a <> then type `lsb_release -ic` to find this information out: @@ -45,8 +49,8 @@ Distributor ID: Debian Codename: Trixie ---- -You should be running on Debian Bullseye, Bookworm or Trixie or Ubuntu 20.04 "Focal Fossa" or newer. -LinuxCNC 2.9.y will not run on older distributions than these. +You should be running on Debian Bookworm or, recommended, Trixie or Ubuntu 24.04 "Noble Numbat" or newer. +LinuxCNC 2.10.y may not run on older distributions than these and is not supported on anything older. You will also need to check which realtime kernel is being used: @@ -87,11 +91,10 @@ RTAI packages are available for Bookworm and Buster but not currently for Bullse [cols="3,5",options="header"] |=== | OS / Realtime Version | Repository -| Debian Bullseye - preempt m| deb https://linuxcnc.org bullseye base 2.9-uspace -| Debian Bookworm - preempt m| deb https://linuxcnc.org bookworm base 2.9-uspace -| Debian Bookworm - RTAI m| deb https://linuxcnc.org bookworm base 2.9-rt -| Debian Trixie - preempt m| deb https://linuxcnc.org trixie base 2.9-uspace -| Debian Trixie - RTAI m| deb https://linuxcnc.org trixie base 2.9-rt +| Debian Bookworm - preempt m| deb https://linuxcnc.org bookworm base 2.10-uspace +| Debian Bookworm - RTAI m| deb https://linuxcnc.org bookworm base 2.10-rt +| Debian Trixie - preempt m| deb https://linuxcnc.org trixie base 2.10-uspace +| Debian Trixie - RTAI m| deb https://linuxcnc.org trixie base 2.10-rt |=== .Figure with a screenshot of the repository configuration of the synaptic package manager. @@ -145,77 +148,83 @@ Codename: trixie ---- Pick the OS from the list then pick the major version you want like -2.9-rt for RTAI or 2.9-uspace for preempt-rt. +2.10-rt for RTAI or 2.10-uspace for preempt-rt. Next pick the type of computer you have: binary-amd64 for 64-bit PC or binary-arm64 (64bit) for Raspberry Pi. Next pick the version you want from the bottom of the list like -'linuxcnc-uspace_2.9.8_amd64.deb' (choose the latest by date). +'linuxcnc-uspace_2.10.0_amd64.deb' (choose the latest by date). Download the deb and copy it to your home directory. You can rename the file to something a bit shorter with the file manager like -'linuxcnc_2.9.8.deb' then open a terminal and install it with the +'linuxcnc_2.19.0.deb' then open a terminal and install it with the package manager with this command: ---- -sudo dpkg -i linuxcnc_2.9.8.deb +sudo dpkg -i linuxcnc_2.10.0.deb ---- +== Updating to 2.10 -== Updating Configuration Files for 2.9 - -=== Stricter handling of pluggable interpreters - -If you just run regular G-code and you don't know what a pluggable -interpreter is, then this section does not affect you. - -A seldom-used feature of LinuxCNC is support for pluggable interpreters, -controlled by the undocumented `[TASK]INTERPRETER` INI setting. +A large set of changes have been implemented in the new version. +The changes include: -Versions of LinuxCNC before 2.9.0 used to handle an incorrect -`[TASK]INTERPRETER` setting by automatically falling back to using the -default G-code interpreter. +* INI: Reworked INI-file parser with consistent types +* HAL: API breaking change implementing new HAL types +* HAL: Make the underlying HAL memory inaccessible and use a proper API +* TP: New selectable scurve trajectory planner added -Since 2.9.0, an incorrect `[TASK]INTERPRETER` value will cause -LinuxCNC to refuse to start up. Fix this condition by deleting the -`[TASK]INTERPRETER` setting from your INI file, so that LinuxCNC will -use the default G-code interpreter. +=== New HAL types +All integer HAL pins are now 64-bit only and the old HAL type names have changed: -=== Canterp +* `HAL_BOOL` - formerly HAL_BIT +* `HAL_REAL` - formerly HAL_FLOAT +* `HAL_SINT` - formerly HAL_S64 +* `HAL_UINT` - formerly HAL_U64 -If you just run regular G-code and you don't use the `canterp` pluggable -interpreter, then this section does not affect you. +The old 32-bit types have been removed: +* `HAL_S32` - removed +* `HAL_U32` - removed -In the extremely unlikely event that you are using `canterp`, -know that the module has moved from `/usr/lib/libcanterp.so` to -`/usr/lib/linuxcnc/canterp.so`, and the `[TASK]INTERPRETER` setting -correspondingly needs to change from `libcanterp.so` to `canterp.so`. - - -=== Spindle limits in the INI +[IMPORTANT] +==== +Any user components must be updated and recompiled. +The old HAL API is no longer available and access to pins/params is not done by getter/setter. +See ...FIXME... for a more detailed description how to update your components. +==== -It is now possible to add settings to the [SPINDLE] section of the INI file +=== Component changes -MAX_FORWARD_VELOCITY = 20000 The maximum spindle speed (in rpm) +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 - replaced by scaled_sint_sums. +* mux_generic - renamed pins +* demux_generic - renamed pins +* demux - renamed pin sel-s32 to sel-sint -MIN_FORWARD_VELOCITY = 3000 The minimum spindle speed (in rpm) +=== Updated Python interface -MAX_REVERSE_VELOCITY = 20000 This setting will default to -MAX_FORWARD_VELOCITY if omitted. +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: -MIN_REVERSE_VELOCITY = 3000` This setting is equivalent to -MIN_FORWARD_VELOCITY but for reverse spindle rotation. It will default -to the MIN_FORWARD_VELOCITY if omitted. +[source,python] +---- +import hal +... -INCREMENT = 200 Sets the step size for spindle speed increment / -decrement commands. This can have a different value for each spindle. -This setting is effective with AXIS and Touchy but note that some -control screens may handle things differently. +# Old: +comp.newpin("pinname", hal.HAL_FLOAT, hal.HAL_IN) -HOME_SEARCH_VELOCITY = 100 - Accepted but currently does nothing +# New: +comp.newpin("pinname", hal.Type.REAL, hal.Dir.IN) +---- -HOME_SEQUENCE = 0 - Accepted but currently does nothing +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.10.y @@ -460,39 +469,16 @@ depth/blend state a part left behind. == New HAL components === Non-Realtime -mdro -mqtt-publisher -pi500_vfd -pmx485-test -qtplasmac-cfg2prefs -qtplasmac-materials -qtplasmac-plasmac2qt -qtplasmac-setup -sim-torch -svd-ps_vfd -=== Realtime -anglejog -div2 -enum -filter_kalman -flipflop -homecomp -limit_axis -mesa_uart -millturn -scaled_s32_sums -tof -ton +...FIXME... -== New Drivers - -A framework for controlling ModBus devices using the serial ports on -many Mesa cards has been introduced. -http://linuxcnc.org/docs/2.9/html/drivers/mesa_modbus.html +=== Realtime -A new GPIO driver for any GPIO which is supported by the gpiod library -is now included: -http://linuxcnc.org/docs/2.9/html/drivers/hal_gpio.html +...FIXME... +== New Drivers +A new ModBus universal driver `hm2_modbus` for Mesa hardware has been created. +It replaces the old mesa_modbus driver and is much more capable. +See hm2_modbus(9) and mesambccc(1). +There are example configurations under `/usr/share/doc/linuxcnc/examples/sample-configs/by_interface/mesa/hm2-modbus`. diff --git a/docs/src/hal/comp.adoc b/docs/src/hal/comp.adoc index 3c30b3c6b64..7118a7aecfe 100644 --- a/docs/src/hal/comp.adoc +++ b/docs/src/hal/comp.adoc @@ -180,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]);' diff --git a/docs/src/hal/components.adoc b/docs/src/hal/components.adoc index 748856db517..5cefb529807 100644 --- a/docs/src/hal/components.adoc +++ b/docs/src/hal/components.adoc @@ -285,6 +285,7 @@ Limit its slew rate to less than maxv per second. Limit its second derivative to | 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 || diff --git a/src/Makefile b/src/Makefile index 05715dd7985..26bd88def1b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -496,7 +496,7 @@ genclean: -rm -f ../lib/*.so.[0-9]* -rm -rf ../docs/build/man -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/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/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/utils/halcompile.g b/src/hal/utils/halcompile.g index 01eaa6f3c66..5ec3e0c6999 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) }} @@ -166,11 +167,14 @@ typemap = { def initialize(): global functions, params, pins, comp_name, names, docs, variables - global modparams, includes, hal_pin_names, hal_funct_names + global modparams, includes + global hal_pin_names, hal_funct_names global funct_derived_claims + global aliases functions = []; params = []; pins = []; options = {}; variables = [] modparams = []; docs = []; includes = []; + aliases = {} comp_name = None names = {} @@ -307,6 +311,22 @@ def param(name, type_, array, dir_, doc, value, personality): 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) hal_name = to_hal(name) @@ -590,6 +610,35 @@ static int comp_id; print(" if(r != 0) return r;", file=f) 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: