// First pass, create the button watching loop
#define CLEVER(turnout, button, route_ind) \
IF(button) \
IFCLOSED(turnout) THROW(turnout) ENDIF \
ELSE \
IF(-button) IFTHROWN(turnout) CLOSE(turnout) ENDIF \
ENDIF
AUTOSTART SEQUENCE(1)
#include "myClever.h"
FOLLOW(1)
#undef CLEVER
// Now replace the clever macro so it creates the ON handlers
#define CLEVER(turnout, button, route_ind) \
ONTHROW(turnout) SET(route_ind) DONE \
ONCLOSE(turnout) RESET(route_ind) DONE
// Pass 2 create the ON handlers
#include "myClever.h"
This sneaky and dirty trick (including the same list more than once with different macro definitions) is exactly how EXRAIL works its magic for all its commands.
Documentation details
For example: ... Move the CLEVER calls list to myClever.h:
Change the CLEVER macro definition to do this:
This sneaky and dirty trick (including the same list more than once with different macro definitions) is exactly how EXRAIL works its magic for all its commands.
Page with issues
No response