Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- component x2Ref "Use second X joint for gantry";
- pin in bit isX2Ref;
- pin in float posX;
- pin out float modPosX2;
- function _;
- license "GPL";
- ;;
- #include <rtapi.h>
- float posXBeforeSwitch = 0.0f;
- float firstPos = 0.0f;
- float curPos = 0.0f;
- FUNCTION(_) {
- if(isX2Ref == 1) {
- posXBeforeSwitch = posX;
- firstPos = curPos;
- }
- else {
- curPos = firstPos - posXBeforeSwitch + posX;
- }
- modPosX2 = firstPos - posXBeforeSwitch + posX; //left
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement