I implemented backlash compensation in my moonlite-compatible arduino code at
https://github.com/beckrd/Moonlite_Focuser
. I always move x steps beyond the targeted amount when moving outward and then move to the target inwards. As Jasem mentioned, the focus module just waits for the moonlite driver to report that the focuser is at target position.
Feel free to use the code or logic as you see fit for your implementation.