# Include your customized HAL commands here
# This file will not be overwritten when you run stepconf again
# my X home/limit is on pin 10 - disconnect it
unlinkp parport.0.pin-10-in
unlinkp axis.0.home-sw-in
unlinkp axis.0.pos-lim-sw-in
# my Y home/limit is on pin 11 - disconnect it
unlinkp parport.0.pin-11-in
unlinkp axis.1.home-sw-in
unlinkp axis.1.neg-lim-sw-in
# my Z home/limit is on pin 12 - disconnect it
unlinkp parport.0.pin-12-in
unlinkp axis.2.home-sw-in
unlinkp axis.2.pos-lim-sw-in
#load the debounce module with 3 debounce channels (only using 1)
loadrt debounce cfg=3
# add the debounce to the base thread
addf debounce.0 base-thread
# debounce for 10 base threads
# Error message with the below value
# : "Home switch inactive before start of backoff move"
# setp debounce.0.delay 10
# 20:44 < djdelorie> I used 0.1 second
# 20:45 < djdelorie> bounce tends to be in the tens of milliseconds range worst-case
# Base thread = 26,000 ns = 26 us
# for 0.1 seconds = 100 milliseconds = 100,000 microseconds
# no. of base threads required for 0.1 secs debounce period =
# 100,000/26 = 3846
# using a debounce period of 3846 base threads
# no errors with the below
# setp debounce.0.delay 3846
# errors with 40, 80 and 385
# setp debounce.0.delay 3846
# Base thread = 50,000 ns = 50 us
# for 0.1 seconds = 100 milliseconds = 100,000 microseconds
# no. of base threads required for 0.1 secs debounce period =
# 100,000/50 = 2,000
# using a debounce period of 2000 base threads
# setp debounce.0.delay 2000
# Base thread = 28,000 ns = 28 us
# for 0.1 seconds = 100 milliseconds = 100,000 microseconds
# no. of base threads required for 0.1 secs debounce period =
# 100,000/28 = 3,571
# using a debounce period of 3571 base threads
setp debounce.0.delay 3571
# once I switched to inches from mm, the below is working fine too.
# setp debounce.0.delay 10
# connect the p-port input
net xhome-raw <= parport.0.pin-10-in => debounce.0.0.in
# link the debounced pin to the home switch
net xhome-filtered <= debounce.0.0.out => axis.0.home-sw-in
net xhome-filtered => axis.0.pos-lim-sw-in
# connect the p-port input
net yhome-raw <= parport.0.pin-11-in => debounce.0.1.in
# link the debounced pin to the home switch
net yhome-filtered <= debounce.0.1.out => axis.1.home-sw-in
net yhome-filtered => axis.1.neg-lim-sw-in
# connect the p-port input
net zhome-raw <= parport.0.pin-12-in => debounce.0.2.in
# link the debounced pin to the home switch
net zhome-filtered <= debounce.0.2.out => axis.2.home-sw-in
net zhome-filtered => axis.2.pos-lim-sw-in