sorry for the wrong Syntax.
so it Looks like you Controller is making a rewind of the code.
you have tryed two seperate methodes for homing (DoButton() and G28.1) with the same result.
i have seen in the Manual of your Motion Controller, that you can select different homing mode's.
have you "played" with this configurastion ?