Limit switch in series with servo winch

Hi all.
I want to use a limit switch to sense when a servo winch rope has reach the bottom and becomes slack. it then stops the winch from spooling irrespective if the radio switch is pressed. I then need to winch the rope (and payload) back in by pressing the radio switch back to third position.
is this possible? and if so how do I do it with Cube mini carrier board and ardupilot rover?
Thanks in advance
Jason

you would need to write a lua script to look at the status of the switch using the button input then stop and move the servo accordingly.