Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement M119: Get Endstop Status #72

Open
Wallacoloo opened this issue Jan 9, 2015 · 1 comment
Open

Implement M119: Get Endstop Status #72

Wallacoloo opened this issue Jan 9, 2015 · 1 comment

Comments

@Wallacoloo
Copy link
Owner

J.S. sent me the following code for his M119 implementation (in state.h):

} else if (cmd.isM119()) { //output endstop status
        LOGW("Warning (state.h): OP_M119 (output endstop status) not implemented\n");
        std::string msgTRIGGERED = "TRIGGERED";
        std::string msgOPEN = "open";
        return gparse::Response(gparse::ResponseOk,
            "Reporting endstop status x_min:" + ((driver.endstopHit(0) == true ) ? msgTRIGGERED : msgOPEN ) +
            " y_min:" + ((driver.endstopHit(1) == true ) ? msgTRIGGERED : msgOPEN ) +
            " z_min:" + ((driver.endstopHit(2) == true ) ? msgTRIGGERED : msgOPEN )  );

It shouldn't be too difficult to get this to compile with the current devel version / machines.

@Wallacoloo
Copy link
Owner Author

Implemented, but the endstops have no labels. So it returns, e.g., Ok triggered open triggered (I lowercased TRIGGERED for compatibility with Teacup).

There are a few ways to fix this:

  1. Add a std::string field to the Endstop object to create a label for it upon instantiation.
  2. Require that endstops are only owned by the CoordMap & query the CoordMap for both the endstop objects and names.

(1) has the downside of being less inline-able.
(2) makes implementation slightly easier.

I'll probably go with (1) because putting the Endstops in the ioDrivers tuple is more consistent with the rest of Printipi, although that paradigm might eventually change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant