I found that homing speed and results are linked, and the results sometimes unpredictable. Details: In the following, the measures are by eye. Lines starting with ==> are the commands sent, and the log shows the response. My switches are Omron . They are connected so, that in normal state, they connect +3.3V through 100R resistor to the switch input. When switched, the resistor input is grounded. I added capacitors to the switch input (I have v7 hw). I'm sorry, I don't remember ther value; might be 1uF. (Of several configurations I tried this proved to be the most noise immune.)
First, here are my settings:
==>{"z":""}
{"r":{"z":{"am":1,"vm":2000,"fr":2000,"tm":80,"jm":2000000000,"jh":2000000000,"jd":0.0100,"sn":3,"sx":2,"sv":500,"lv":500,"lb":6.000,"zb":0.000}},"f":[1,0,9,8566]}
==>{"sys":""}
{"r":{"sys":{"fb":392.65,"fv":0.970,"hv":8,"id":"9H3583-PZP","ja":100000,"ct":0.0010,"st":0,"mt":3.00,"ej":1,"jv":3,"tv":1,"qv":2,"sv":1,"si":200,"ec":0,"ee":0,"ex":0,"baud":5,"":0,"gpl":0,"gun":1,"gco":2,"gpa":2,"gdi":0}},"f":[1,0,11,8615]}
==>{"3":""}
{"r":{"3":{"ma":2,"sa":1.80,"tr":8.000,"mi":2,"po":1,"pm":0}},"f":[1,0,9,744]}
Repeated homing results: About third of the time, the switch lever stays in touch of the triggering post, about 2/3 of the time, there is about 6mm gap.
In the following, the first homing cycle resulted to the gap, the second left the lever touching.
==>G28.2 Z0
{"r":{},"f":[1,0,9,4402]}
{"sr":{"coor":0,"dist":1,"home":0,"cycs":3}}
{"qr":28}
{"qr":27}
{"sr":{"mpoz":-1.393,"stat":9,"momo":1,"macs":5,"mots":1}}
{"sr":{"mpoz":-3.018}}
{"sr":{"mpoz":-4.643}}
{"sr":{"mpoz":-5.958,"hold":4,"mots":2}}
{"qr":27}
{"sr":{"mpoz":-4.524,"hold":0,"mots":1}}
{"sr":{"mpoz":-2.899}}
{"sr":{"mpoz":-1.274}}
{"sr":{"mpoz":0.042,"stat":3,"macs":3,"mots":0}}
{"qr":28}
{"sr":{"mpoz":0.000,"coor":2,"momo":4,"dist":0,"home":1,"cycs":0}}
{"qr":28}
==>G28.2 Z0
{"r":{},"f":[1,0,9,4402]}
{"sr":{"coor":0,"dist":1,"home":0,"cycs":3}}
{"qr":28}
{"qr":27}
{"sr":{"mpoz":-1.435,"stat":9,"momo":1,"macs":5,"mots":1}}
{"sr":{"mpoz":-3.060}}
{"sr":{"mpoz":-4.685}}
{"sr":{"mpoz":-6.042,"hold":4,"mots":2}}
{"qr":27}
{"sr":{"mpoz":-4.649,"hold":0,"mots":1}}
{"sr":{"mpoz":-4.292,"hold":4,"mots":2}}
{"sr":{"mpoz":0.000,"stat":3,"coor":2,"momo":4,"dist":0,"home":1,"hold":0,"macs":3,"cycs":0,"mots":0}}
{"qr":28}
My system changes latch and search velocities together (with at least 50ms gap belween the commands). Change them to 100:
==>{"zlv":100}
{"r":{"zlv":100},"f":[1,0,12,5378]}
==>{"zsv":100}
{"r":{"zsv":100},"f":[1,0,12,9597]}
Result: Always leaves the lever touching. Here is a log:
==>G28.2 Z0
{"r":{},"f":[1,0,9,4402]}
{"sr":{"coor":0,"dist":1,"home":0,"cycs":3}}
{"qr":28}
{"qr":27}
{"sr":{"mpoz":-0.318,"stat":9,"momo":1,"macs":5,"mots":1}}
{"sr":{"mpoz":-0.643,"hold":3,"mots":2}}
{"sr":{"mpoz":-0.645,"hold":4}}
{"qr":27}
{"sr":{"mpoz":-0.327,"hold":0,"mots":1}}
{"sr":{"mpoz":-0.011,"hold":3,"mots":2}}
{"sr":{"mpoz":-0.009,"hold":4}}
{"sr":{"mpoz":0.000,"stat":3,"coor":2,"momo":4,"dist":0,"home":1,"hold":0,"macs":3,"cycs":0,"mots":0}}
{"qr":28}
Using faster settings (but still easily within the limits of the machine):
==>{"zlv":1000}
{"r":{"zlv":1000},"f":[1,0,13,2994]}
==>{"zsv":1000}
{"r":{},"f":[1,0,16,75]}
Result: about 1mm gap, always. Log:
==>G28.2 Z0
{"r":{},"f":[1,0,9,4402]}
{"sr":{"coor":0,"dist":1,"home":0,"cycs":3}}
{"qr":28}
{"qr":27}
{"sr":{"mpoz":-2.578,"stat":9,"momo":1,"macs":5,"mots":1}}
{"sr":{"mpoz":-3.412,"hold":4,"mots":2}}
{"qr":27}
{"sr":{"mpoz":-0.782,"hold":0,"mots":1}}
{"sr":{"mpoz":0.049,"hold":4,"mots":2}}
{"sr":{"mpoz":0.000,"stat":3,"coor":2,"momo":4,"dist":0,"home":1,"hold":0,"macs":3,"cycs":0,"mots":0}}
{"qr":28}
Faster still:
==>{"zsv":2000}
{"r":{"zsv":2000},"f":[1,0,13,5551]}
==>{"zlv":2000}
{"r":{"zlv":2000},"f":[1,0,13,1200]}
Result: about 3mm gap; bigger than with 1000, smaller than the long gap with 500. A log:
==>G28.2 Z0
{"r":{},"f":[1,0,9,4402]}
{"sr":{"coor":0,"dist":1,"home":0,"cycs":3}}
{"qr":28}
{"qr":27}
{"sr":{"mpoz":-4.730,"stat":9,"momo":1,"hold":3,"macs":5,"mots":2}}
{"sr":{"mpoz":-6.500,"hold":4}}
{"qr":27}
{"sr":{"mpoz":-1.968,"hold":0,"mots":1}}
{"sr":{"mpoz":-0.040,"hold":4,"mots":2}}
{"sr":{"mpoz":0.000,"stat":3,"coor":2,"momo":4,"dist":0,"home":1,"hold":0,"macs":3,"cycs":0,"mots":0}}
{"qr":28}
What might be going on? Debounce not quite working? Did I discover a bug?