Python Component issueing errors or warnings to LinuxCNC

More
5 years 5 months ago #208500 by cmorley
So I slapped together some code to test with:
Code:
PyObject *MESSAGE_(pyErrorChannel *s, PyObject *args ) { char *m; EMC_OPERATOR_DISPLAY operator_display_msg; if(!PyArg_ParseTuple(args, "s", &m)) return NULL; if(!s->c->valid()) { PyErr_Format( error, "Error buffer invalid" ); return NULL; } operator_display_msg.id = 0; strncpy(operator_display_msg.display, m, LINELEN); operator_display_msg.display[LINELEN - 1] = 0; s->c->write(operator_display_msg); Py_RETURN_NONE; } static PyMethodDef Error_methods[] = { {"poll", (PyCFunction)Error_poll, METH_NOARGS, "Poll for errors"}, {"MESSAGE_", (PyCFunction)MESSAGE_, METH_VARARGS, "Send message"}, {NULL} };

and the message is accepted but never sent it seems.
I can't find much examples of sending messages on the error channel other then emctaskmain.cc

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #208549 by Roiki
I don't think you send it on the error channel but the command channel. Try it that way and see what happens?

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #208560 by cmorley
Yes that did the trick - thanks.
Unfortunately all display messages can only be accepted in auto mode.

There is an NML_ERROR message but I don't understand how to send this NML message

More research needed..

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #208605 by cmorley
Well it seems EMC_OPERATOR_ERROR_TYPE messages can be made to always display by modifying emctaskmain.cc to accept them.

I just don't understand if there is a disadvantage to always accepting them.

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #208654 by andypugh
Do it and see who complains? :-)

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #208673 by cmorley
lol You know you are right.
Thanks Andy

Please Log in or Create an account to join the conversation.

Time to create page: 0.130 seconds
Powered by Kunena Forum