M1xx output
- tuxcnc
- Offline
- Premium Member
Less
More
- Posts: 118
- Thank you received: 5
30 Aug 2020 14:03 #180075
by tuxcnc
M1xx output was created by tuxcnc
Hi.
My Linuxcnc is 2.9.0-pre.
I have wifi relay module based on ESP-01S and written M1xx programs to manage it from Linuxcnc.
There is wifi is no matter, because works well, the problem is else.
When relay module is powered, my M1xx g-codes works and relay is toggled .
Problem started when module is not powered.
I want stop Linuxcnc in this case and no act with not working hardware.
In summary :
1. When module is powered all works as expected.
2. When module is not powered (or no communication), in MDI mode M1xx acts nothing at all, in RUN PROGRAM mode program ends in line contains M1xx, like should, but no message is given.
3. When I run program M1xx from terminal (it is executable bash script) message is given by display command from ImageMagick, as expected.
Some explanation :Program above turns on relay. Command curl gets http page from module, contained line with 'Relay is now: ON', it mean "all went well and relay is turned on", and program is exitted with 0 value. If get no page, it mean something went bad, and script display error message and exit with -1 value.
The program turning relay off is similar.
Why the output from M1xx is ignored at all, or works but not as expected ?
My Linuxcnc is 2.9.0-pre.
I have wifi relay module based on ESP-01S and written M1xx programs to manage it from Linuxcnc.
There is wifi is no matter, because works well, the problem is else.
When relay module is powered, my M1xx g-codes works and relay is toggled .
Problem started when module is not powered.
I want stop Linuxcnc in this case and no act with not working hardware.
In summary :
1. When module is powered all works as expected.
2. When module is not powered (or no communication), in MDI mode M1xx acts nothing at all, in RUN PROGRAM mode program ends in line contains M1xx, like should, but no message is given.
3. When I run program M1xx from terminal (it is executable bash script) message is given by display command from ImageMagick, as expected.
Some explanation :
#!/bin/bash
if ! curl http://192.168.43.11/RELAY=ON | grep 'Relay is now: ON' >/dev/null 2>&1
then
echo "M111 failed"
exec display M111-failed.png.
exit -1
fi
echo "M111 ok"
exit 0
The program turning relay off is similar.
Why the output from M1xx is ignored at all, or works but not as expected ?
Attachments:
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
Less
More
- Posts: 17987
- Thank you received: 4835
30 Aug 2020 16:01 #180085
by PCW
Replied by PCW on topic M1xx output
A quick guess would be that "display" is not in the path
have you tried a absolute path?
have you tried a absolute path?
Please Log in or Create an account to join the conversation.
- tuxcnc
- Offline
- Premium Member
Less
More
- Posts: 118
- Thank you received: 5
30 Aug 2020 16:10 #180087
by tuxcnc
Replied by tuxcnc on topic M1xx output
SOLVED !
I have trying with feh and qview, but the same effects.
I finally found - Linuxcnc losts the image file path.
You must give absolute path to image.
Now works as expected.
I have trying with feh and qview, but the same effects.
I finally found - Linuxcnc losts the image file path.
You must give absolute path to image.
#!/bin/bash
if ! curl http://192.168.43.11/RELAY=ON | grep 'Relay is now: ON' >/dev/null 2>&1
then
echo "M111 failed"
display ~/linuxcnc/nc_files/M111-failed.png
exit -1
fi
echo "M111 ok"
exit 0
Now works as expected.
Attachments:
Please Log in or Create an account to join the conversation.
- tuxcnc
- Offline
- Premium Member
Less
More
- Posts: 118
- Thank you received: 5
30 Aug 2020 16:43 - 30 Aug 2020 16:44 #180092
by tuxcnc
Problem is complex.
The image is in the same folder as script, and you can run it without absolute path in script, if running in place.
Launch from anywhere requires absolute path in script.
This is the explanation.
But there is another question, why exit -1 works when running program, but is ignored in MDI mode ?
I mean, when M1xx failed, program is aborted, but in MDI mode even no message is displayed.
Replied by tuxcnc on topic M1xx output
A quick guess would be that "display" is not in the path
have you tried a absolute path?
Problem is complex.
The image is in the same folder as script, and you can run it without absolute path in script, if running in place.
Launch from anywhere requires absolute path in script.
This is the explanation.
But there is another question, why exit -1 works when running program, but is ignored in MDI mode ?
I mean, when M1xx failed, program is aborted, but in MDI mode even no message is displayed.
Last edit: 30 Aug 2020 16:44 by tuxcnc.
Please Log in or Create an account to join the conversation.
Time to create page: 0.096 seconds