Refractor hooks for move macros
Created by: dschick
as discussed yesterday in the follow-up meeting, I am already trying to refector parts of the macros for movements based on #1480
However, I just noticed that besides moving the hints
to the new base class MoveMacro
which then inherits from Macro
and Hookable
there is not much to refractor, since we do not define what actually happens in the move-macros, e.g. which underlying macro is called.
So umv
calls mv
but umvr
calls umv
and so on. And we can also not define that for any new Macros which developers/users will come up.
As I see it, it is most "effort" to hand the hooks
to the final mv
macro, which currenlty requires
mv, _ = self.createMacro('umv', motor_pos_list)
mv._setHooks(self.hooks)
self.runMacro(mv)
instead of
self.executeMacro('umv', motor_pos_list)
Regarding the self.motors
one could ask about that from the called macro, right?
So refering to the line above, one could add at the end:
self.motors = mv.motors
As @reszelaz mentioned in his comment self.motors
will be provided by the mv
macro in the pre-move
and post-move
hooks.
We agreed to stil implement this property for all move macros for consistency.
But should it be available already in the prepare
or in the run
method?
I have move the filling of self.motors
in the mv
macro already into its prepare
method.
So any ideas how to simplify this further?