Skip to content

Commit cb934ee

Browse files
committed
xhc-hb04.tcl: provide defaults if missing ini item
If ini seting [XHC_HB04_CONFIG]mpg_accels item was omitted, error reported was misleading, example: "Missing ini setting: [AXIS_X]MAX_ACCELERATION" So, provide defaults so mpg_accels is not required.
1 parent 5e69430 commit cb934ee

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/hallib/xhc-hb04.tcl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ proc connect_pins {} {
124124
} ;# connect_pins
125125

126126
proc wheel_setup {jogmode} {
127+
for {set idx 0} {$idx < 4} {incr idx} {
128+
set ::XHC_HB04_CONFIG(accel,$idx) 1.0 ;# default if unspecified
129+
}
127130
if [info exists ::XHC_HB04_CONFIG(mpg_accels)] {
128131
set idx 0
129132
foreach g $::XHC_HB04_CONFIG(mpg_accels) {
@@ -273,7 +276,7 @@ proc wheel_setup {jogmode} {
273276
set afraction [expr $::XHC_HB04_CONFIG(accel,$idx)\
274277
/[set ::AXIS_[set COORD](MAX_ACCELERATION)] ]
275278
} msg] {
276-
err_exit "Missing ini setting: \[AXIS_$COORD\]MAX_ACCELERATION"
279+
err_exit "<$msg>\n\nMissing ini setting: \[AXIS_$COORD\]MAX_ACCELERATION"
277280
}
278281
setp axis.$coord.jog-accel-fraction $afraction
279282

@@ -301,7 +304,7 @@ proc wheel_setup {jogmode} {
301304
set jfraction [expr $::XHC_HB04_CONFIG(accel,$idx)\
302305
/[set ::JOINT_[set jnum](MAX_ACCELERATION)] ]
303306
} msg] {
304-
err_exit "Missing ini setting: \[JOINT_$jnum\]MAX_ACCELERATION"
307+
err_exit "<$msg>\n\nMissing ini setting: \[JOINT_$jnum\]MAX_ACCELERATION"
305308
}
306309
setp joint.$jnum.jog-accel-fraction $jfraction
307310

0 commit comments

Comments
 (0)