Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions configs/sim/axis/ja_tests/xyzx_mpg/xhc-hb04.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,47 +28,47 @@ mpg_accels = 20 20 20 20

[XHC_HB04_BUTTONS]
# use button names according to layout file LIB:xhc-hb04-layout{n}.cfg
# note: "start-pause" is connected for standard behavior
# note: "start_pause" is connected for standard behavior
# controlling halui.pause/halui.resume/halui.run
# these are examples, edit as required:

goto-zero = halui.mdi-command-00
goto_zero = halui.mdi-command-00
# synthesized per-axis buttons for goto-zero button:
goto-zero-x = ""
goto-zero-y = ""
goto-zero-z = ""
goto-zero-a = ""
goto_zero_x = ""
goto_zero_y = ""
goto_zero_z = ""
goto_zero_a = ""

start-pause = std_start_pause
start_pause = std_start_pause
rewind = halui.program.step
# probe-input for simulating a probe:
probe-z = motion.probe-input
macro-3 = halui.mdi-command-03
probe_z = motion.probe-input
macro_3 = halui.mdi-command-03

half = halui.spindle.0.stop
# synthesized per-axis buttons for half button:
half-x = ""
half-y = ""
half-z = ""
half-a = ""
half_x = ""
half_y = ""
half_z = ""
half_a = ""

zero = ""
# synthesized per-axis buttons for zero button:
zero-x = halui.mdi-command-12
zero-y = halui.mdi-command-13
zero-z = halui.mdi-command-14
zero-a = halui.mdi-command-15
zero_x = halui.mdi-command-12
zero_y = halui.mdi-command-13
zero_z = halui.mdi-command-14
zero_a = halui.mdi-command-15

safe-z = halui.mdi-command-10
safe_z = halui.mdi-command-10
# in this sim, home-all only works first time, hold down till finished:
home = halui.home-all
macro-1 = halui.mdi-command-01
macro-2 = halui.mdi-command-02
macro_1 = halui.mdi-command-01
macro_2 = halui.mdi-command-02
spindle = halui.spindle.0.start
step = xhc-hb04.stepsize-up
mode = ""
macro-6 = halui.mdi-command-06
macro-7 = halui.mdi-command-07
macro_6 = halui.mdi-command-06
macro_7 = halui.mdi-command-07
stop = halui.program.stop
reset = halui.estop.activate

Expand Down
12 changes: 7 additions & 5 deletions configs/sim/axis/xhc-hb04/README
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Sim configurations are provided for two known button configurations:
layout1 -- 16 buttons
layout2 -- 18 buttons (more common)

The button names are defined in the files LIB:xhc-hb04-layout*.cfg in a stanza labeled XHC-HB04 with definitions as BUTTON=XX:name where XX is a hexadecimal code used by the device.
The button names are defined in the files LIB:xhc-hb04-layout*.cfg in a stanza labeled XHC_HB04 with definitions as BUTTON=XX:name where XX is a hexadecimal code used by the device.

Example:
[XHC-HB04]
[XHC_HB04]
BUTTON=01:button-stop
BUTTON=03:button-rewind
...
Expand Down Expand Up @@ -111,20 +111,22 @@ sequence: Typically use 1 for mm-based machine, 2 for inch-based machine

----------------------------------
Pendant buttons are connected to hal pins with ini file items.
Ini identifiers cannot contain a dash, so button names use underscores
in the ini file and are mapped to the dashed hal pin names.
Examples:
[XHC_HB04_BUTTONS]
stop = halui.program.stop
goto-zero = halui.mdi-command-00
goto_zero = halui.mdi-command-00
step = xhc-hb04.stepsize-up
rewind = halui.program.step
macro-1 = halui.mdi-command-01
macro_1 = halui.mdi-command-01
mode = "" (placeholder)

With the above items, connections are made as:
Signal_name Source pin Destination pin
----------------- ---------------------------- ------------------------
pendant:stop <== xhc-hb04.button-stop ==> halui.program.stop
pendant:goto-zero <== xhc-hb04.button-goto-zero ==> halui.mdi-command-00
pendant:goto_zero <== xhc-hb04.button-goto-zero ==> halui.mdi-command-00
pendant:step <== xhc-hb04.button-step ==> xhc-hb04.stepsize-up
etc ...

Expand Down
18 changes: 9 additions & 9 deletions configs/sim/axis/xhc-hb04/layout1.inc
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
[XHC_HB04_BUTTONS]
# use button names according to layout file LIB:xhc-hb04-layout{n}.cfg
# note: "start-pause" is connected for standard behavior
# note: "start_pause" is connected for standard behavior
# controlling halui.pause/halui.resume/halui.run
# these are examples, edit as required:
stop = halui.program.stop
start-pause = std_start_pause
start_pause = std_start_pause
rewind = halui.program.step
safe-z = halui.mdi-command-01
safe_z = halui.mdi-command-01
# in this sim, home-all only works first time, hold down till finished:
home = halui.home-all
x2 = halui.mdi-command-02
y2 = halui.mdi-command-03
# probe-input for simulating a probe:
probe-z = motion.probe-input
probe_z = motion.probe-input
x0 = halui.mdi-command-04
y0 = halui.mdi-command-05
z0 = halui.mdi-command-06

goto-zero = halui.mdi-command-00
goto_zero = halui.mdi-command-00
# synthesized per-axis buttons for goto-zero button:
goto-zero-x = ""
goto-zero-y = ""
goto-zero-z = ""
goto-zero-a = ""
goto_zero_x = ""
goto_zero_y = ""
goto_zero_z = ""
goto_zero_a = ""

step = xhc-hb04.stepsize-up
mode = ""
Expand Down
44 changes: 22 additions & 22 deletions configs/sim/axis/xhc-hb04/layout2.inc
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
[XHC_HB04_BUTTONS]
# use button names according to layout file LIB:xhc-hb04-layout{n}.cfg
# note: "start-pause" is connected for standard behavior
# note: "start_pause" is connected for standard behavior
# controlling halui.pause/halui.resume/halui.run
# these are examples, edit as required:

goto-zero = halui.mdi-command-00
goto_zero = halui.mdi-command-00
# synthesized per-axis buttons for goto-zero button:
goto-zero-x = ""
goto-zero-y = ""
goto-zero-z = ""
goto-zero-a = ""
goto_zero_x = ""
goto_zero_y = ""
goto_zero_z = ""
goto_zero_a = ""

start-pause = std_start_pause
start_pause = std_start_pause
rewind = halui.program.step
# probe-input for simulating a probe:
probe-z = motion.probe-input
macro-3 = halui.mdi-command-03
probe_z = motion.probe-input
macro_3 = halui.mdi-command-03

half = halui.spindle.0.stop
# synthesized per-axis buttons for half button:
half-x = ""
half-y = ""
half-z = ""
half-a = ""
half_x = ""
half_y = ""
half_z = ""
half_a = ""

zero = ""
# synthesized per-axis buttons for zero button:
zero-x = halui.mdi-command-12
zero-y = halui.mdi-command-13
zero-z = halui.mdi-command-14
zero-a = halui.mdi-command-15
zero_x = halui.mdi-command-12
zero_y = halui.mdi-command-13
zero_z = halui.mdi-command-14
zero_a = halui.mdi-command-15

safe-z = halui.mdi-command-10
safe_z = halui.mdi-command-10
# in this sim, home-all only works first time, hold down till finished:
home = halui.home-all
macro-1 = halui.mdi-command-01
macro-2 = halui.mdi-command-02
macro_1 = halui.mdi-command-01
macro_2 = halui.mdi-command-02
spindle = halui.spindle.0.start
step = xhc-hb04.stepsize-up
mode = ""
macro-6 = halui.mdi-command-06
macro-7 = halui.mdi-command-07
macro_6 = halui.mdi-command-06
macro_7 = halui.mdi-command-07
stop = halui.program.stop
reset = halui.estop.activate

Expand Down
2 changes: 1 addition & 1 deletion configs/sim/axis/xhc-hb04/xhc-hb04-layout1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ xhc-hb04-layout1
Button codes defined in LIB:xhc-hb04-layout1.cfg

The Start/Pause button can be connected for standard behavior with:
[XHC_HB04_BUTTON]start-pause = std_start_pause
[XHC_HB04_BUTTONS]start_pause = std_start_pause

The STEP button is normally connected with:
[XHC_HB04_BUTTON]step = xhc-hb04.stepsize-up
Expand Down
2 changes: 1 addition & 1 deletion configs/sim/axis/xhc-hb04/xhc-hb04-layout1_es.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ xhc-hb04-layout1
Button codes defined in LIB:xhc-hb04-layout1.cfg

El botón Start/Pause se puede conectar para un comportamiento estándar con:
[XHC_HB04_BUTTON]start-pause = std_start_pause
[XHC_HB04_BUTTONS]start_pause = std_start_pause

El botón STEP normalmente está conectado con:
[XHC_HB04_BUTTON]step = xhc-hb04.stepsize-up
Expand Down
2 changes: 1 addition & 1 deletion configs/sim/axis/xhc-hb04/xhc-hb04-layout2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ xhc-hb04-layout2
Button codes defined in LIB:xhc-hb04-layout2.cfg

The Start/Pause button can be connected for standard behavior with:
[XHC_HB04_BUTTON]start-pause = std_start_pause
[XHC_HB04_BUTTONS]start_pause = std_start_pause

The STEP button is normally connected with:
[XHC_HB04_BUTTON]step = xhc-hb04.stepsize-up
Expand Down
2 changes: 1 addition & 1 deletion configs/sim/axis/xhc-hb04/xhc-hb04-layout2_es.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ xhc-hb04-layout2
Códigos de botón definidos en LIB:xhc-hb04-layout2.cfg

El botón Start/Pause se puede conectar para un comportamiento estándar con:
[XHC_HB04_BUTTON]start-pause = std_start_pause
[XHC_HB04_BUTTONS]start_pause = std_start_pause

El botón STEP normalmente está conectado con:
[XHC_HB04_BUTTON]step = xhc-hb04.stepsize-up
Expand Down
2 changes: 1 addition & 1 deletion docs/src/man/man1/xhc-hb04.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ should use a file suffix of .cfg.

....
File format:
[XHC-HB04]
[XHC_HB04]
BUTTON=X1:button-thename1
BUTTON=X2:button-thename2
BUTTON=X3:button-thename3
Expand Down
2 changes: 1 addition & 1 deletion lib/hallib/xhc-hb04-layout1.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[XHC-HB04]
[XHC_HB04]
BUTTON=01:button-stop
BUTTON=02:button-start-pause
BUTTON=03:button-rewind
Expand Down
2 changes: 1 addition & 1 deletion lib/hallib/xhc-hb04-layout2.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[XHC-HB04]
[XHC_HB04]
BUTTON=01:button-goto-zero
BUTTON=02:button-start-pause
BUTTON=03:button-rewind
Expand Down
14 changes: 10 additions & 4 deletions lib/hallib/xhc-hb04.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ source [file join $::env(HALLIB_DIR) util_lib.tcl]
# [XHC_HB04_BUTTONS]
# name = pin (connect button to hal pin)
# name = "" (no connect button)
# button names use underscores in the INI (start_pause, goto_zero,
# ...) and are mapped to the dashed hal pin names
# (xhc-hb04.button-start-pause, xhc-hb04.button-goto-zero, ...)
# special cases:
# start-pause = std_start_pause (for usual behavior)
# start_pause = std_start_pause (for usual behavior)
# step = xhc-hb04.stepsize-up (for usual behavior)
# (see INI files for more exanples)

# Notes:
# 1) the 'start-pause' pin can be set to "std_start_pause" to
# 1) the 'start_pause' INI item can be set to "std_start_pause" to
# implement default behavior
# 2) the 'step' pin is normally connected to xhc-hb04.stepsize-up
# 3) non-root access to the usb device requires an additional
Expand Down Expand Up @@ -95,8 +98,11 @@ proc connect_pins {} {
#puts stderr "$::progname: no pin defined for <$bname>"
continue
}
# INI identifiers cannot contain a dash, so button names use
# underscores in the INI; the hal pin names keep the dashes
set pin_bname [string map {_ -} $bname]
# this pin is can specify std behavior
if { ([string tolower $bname] == "start-pause")
if { ([string tolower $pin_bname] == "start-pause")
&& ([string tolower $thepin] == "std_start_pause")
} {
std_start_pause_button
Expand All @@ -108,7 +114,7 @@ proc connect_pins {} {
puts stderr "$::progname: skipping button $bname marked <$thepin>"
continue
}
set fullbname xhc-hb04.button-$bname
set fullbname xhc-hb04.button-$pin_bname
if !$::xhc_hb04_quiet {
if ![pin_exists $fullbname] {
puts stderr "$::progname: !!! <$fullbname> pin does not exist, continuing"
Expand Down
8 changes: 7 additions & 1 deletion scripts/linuxcnc.in
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,13 @@ fi
# Running inivalue without section/variable filter should return the value of
# the first variable in the first section of the file. If that fails, there is
# a parse error in the file or it is empty.
inivalue "$INIFILE" > /dev/null || { echo "E: The INI-file contains errors that need to be fixed."; exit 1; }
if ! inivalue "$INIFILE" > /dev/null; then
# Older configs may use dashed identifiers (e.g. the xhc-hb04 pendant
# button names), which the ini parser no longer accepts. Try to rewrite
# them with underscores and test again.
update_ini --fix-identifiers "$INIFILE"
inivalue "$INIFILE" > /dev/null || { echo "E: The INI-file contains errors that need to be fixed."; exit 1; }
fi
Comment thread
BsAtHome marked this conversation as resolved.

# delete directories from path, save name only
INI_NAME="${INIFILE##*/}"
Expand Down
Loading
Loading