- Posts: 10
- Thank you received: 0
G-Code to turn machine OFF
- MasterSpoon
- Offline
- New Member
-
Less
More
7 years 4 months ago #138080
by MasterSpoon
Booya, we have a winner !
Okay so tried that code, didn't work but it led me to the answer
M130
M129
M300
M129 effectively resets the Pin, but M129 then M130 straight after appears to try too quickly before the M129 has reset the pin and it doesn't work
M300 resets the pin, turns off coolant & spindle, waits 5 seconds for them to spin down then hits the E-Stop
I'm now one step closer to having it all set exactly how I want, thank you for the help
Replied by MasterSpoon on topic Re:G-Code to turn machine OFF
cmorley wrote: I would try something like:
Code:#! /bin/bash halcmd setp halui.machine.off 0 halcmd setp halui.machine.off 1 exit 0
halui expects the pin to toggle.
Chris M
Booya, we have a winner !
Okay so tried that code, didn't work but it led me to the answer
M130
Code:
#! /bin/bash
halcmd setp halui.estop.activate 1
exit 0
Code:
#! /bin/bash
halcmd setp halui.estop.activate 0
exit 0
Code:
o<m300> sub
m129
M9
M5
G4 P5
m130
m30
o<m300> endsub
M129 effectively resets the Pin, but M129 then M130 straight after appears to try too quickly before the M129 has reset the pin and it doesn't work
M300 resets the pin, turns off coolant & spindle, waits 5 seconds for them to spin down then hits the E-Stop
I'm now one step closer to having it all set exactly how I want, thank you for the help
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
-
Less
More
- Posts: 19899
- Thank you received: 4655
7 years 4 months ago #138105
by andypugh
Replied by andypugh on topic Re:G-Code to turn machine OFF
I am surprised that the G-code subroutine continues to execute through e-stop.
Try doing it all in the bash script, but re-set the pins afterwards.
I don't have bash here so can't test this, but the idea is to turn off spindle and coolant, wait 5 secs, toggle e-stop then poll the machine status until e-stop has activated.
Then all the halui pins are toggled back to zero for the next time round.
Try doing it all in the bash script, but re-set the pins afterwards.
Code:
#! /bin/bash
halcmd setp halui.flood.off 1
halcmd setp halui.spindle.stop 1
sleep 5
halcmd setp halui.estop.activate 1
halcmd getp halui.machine.is-on
while [ $? = 1]
do
sleep 1
halcmd getp halui.machine.is-on
done
halcmd setp halui.estop.activate 0
halcmd setp halui.flood.off 0
halcmd setp halui.spindle.stop 0
exit 0
I don't have bash here so can't test this, but the idea is to turn off spindle and coolant, wait 5 secs, toggle e-stop then poll the machine status until e-stop has activated.
Then all the halui pins are toggled back to zero for the next time round.
Please Log in or Create an account to join the conversation.
- pl7i92
- Offline
- Platinum Member
-
Less
More
- Posts: 1872
- Thank you received: 358
7 years 4 months ago #138108
by pl7i92
Replied by pl7i92 on topic G-Code to turn machine OFF
5-7 seconds of untrou states that is a real whear behavior even on e-stop
E-stop is e-stop
then user shoudt take action non Mcode state changes after this
Why at all shoudt the G-code trigger e-stop
this is mashine and safty issue non g-code related
im with you at M9 M5 M30
the Mashine off as on large printings 24+ hr is here a Realy that shuts the complete power down
g-code mashine issues behavior is real wheard
E-stop is e-stop
then user shoudt take action non Mcode state changes after this
Why at all shoudt the G-code trigger e-stop
this is mashine and safty issue non g-code related
im with you at M9 M5 M30
the Mashine off as on large printings 24+ hr is here a Realy that shuts the complete power down
g-code mashine issues behavior is real wheard
Please Log in or Create an account to join the conversation.
- MasterSpoon
- Offline
- New Member
-
Less
More
- Posts: 10
- Thank you received: 0
7 years 4 months ago #138115
by MasterSpoon
I gave your code a try as it seemed a bit more elegant then my solution but for some reason the sleep command doesn't work in the bash script.
If I even try just
then the code still runs but it seems to ignore the sleep command and just toggles it off straight away as if sleep wasn't there.
I also tried sleep 5s but no dice either.
Replied by MasterSpoon on topic Re:G-Code to turn machine OFF
andypugh wrote: Try doing it all in the bash script, but re-set the pins afterwards.
I gave your code a try as it seemed a bit more elegant then my solution but for some reason the sleep command doesn't work in the bash script.
If I even try just
Code:
#! /bin/bash
sleep 5
halcmd setp halui.estop.activate 1
exit 0
I also tried sleep 5s but no dice either.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
-
Less
More
- Posts: 19899
- Thank you received: 4655
7 years 4 months ago #138116
by andypugh
Replied by andypugh on topic Re:G-Code to turn machine OFF
Try "5s"
Maybe it defaults to nS or something?
Maybe it defaults to nS or something?
Please Log in or Create an account to join the conversation.
- pl7i92
- Offline
- Platinum Member
-
Less
More
- Posts: 1872
- Thank you received: 358
7 years 4 months ago #138127
by pl7i92
Replied by pl7i92 on topic G-Code to turn machine OFF
get a
sleep --help
and somtimes the wrong bash sleep versions
sleep --version
sleep --help
and somtimes the wrong bash sleep versions
sleep --version
Please Log in or Create an account to join the conversation.
Time to create page: 0.132 seconds