Fans to turn on when starting program
15 Feb 2022 18:58 #234971
by remon_v
Fans to turn on when starting program was created by remon_v
Hello,
I'm completely new to Linux(CNC) and I'm setting up my first config ever.
I would like to actively cool my stepper motors, either manually via a button in PyVCP or when running a program.
So when a program is running I would like the manual button greyed out.
What I got so far is a PyVCP button and a G-code command M64P0 (I believe), I've attached the files.
The G-code option is not necessary for me.
It would also be nice (but I'm not sure if it's possible) to see a little fan Icon in my PyVCP panel.
Any help would be nice, thanks in advance!
I'm completely new to Linux(CNC) and I'm setting up my first config ever.
I would like to actively cool my stepper motors, either manually via a button in PyVCP or when running a program.
So when a program is running I would like the manual button greyed out.
What I got so far is a PyVCP button and a G-code command M64P0 (I believe), I've attached the files.
The G-code option is not necessary for me.
It would also be nice (but I'm not sure if it's possible) to see a little fan Icon in my PyVCP panel.
Any help would be nice, thanks in advance!
Please Log in or Create an account to join the conversation.
15 Feb 2022 19:52 #234974
by MaHa
Replied by MaHa on topic Fans to turn on when starting program
When program running, 'halui.mode.is-auto' is true
replace this line
by
this toggles the 2 gifs of the fan
To create icons, i used Greenfish Icon Editor.
You can design a red and a green fan, save as fanon.gif and fanof.gif
net modauto halui.mode.is-auto
replace this line
net fans-gcode motion.digital-out-00 => or2.0.in0
by
net modauto => or2.0.in0
this toggles the 2 gifs of the fan
net modauto pyvcp.selectimage
To create icons, i used Greenfish Icon Editor.
You can design a red and a green fan, save as fanon.gif and fanof.gif
<image name='fanon' file='fanon.gif'/>
<image name='fanof' file='fanof.gif'/>
<vbox>
<image_bit halpin='selectimage' images='fanon fanof'/>
</vbox>
The following user(s) said Thank You: remon_v
Please Log in or Create an account to join the conversation.
15 Feb 2022 23:01 #234990
by remon_v
Replied by remon_v on topic Fans to turn on when starting program
Thanks for the quick reply!
I will try it out in the morning…
I will try it out in the morning…
Please Log in or Create an account to join the conversation.
16 Feb 2022 09:20 - 16 Feb 2022 09:51 #235021
by remon_v
Replied by remon_v on topic Fans to turn on when starting program
I'm getting closer... but it's not there yet.
When I'm starting LinuxCNC it starts with a 'green' fan, that should be red/off.
Also, It's not a button yet.
When I start the program, the fan changes from green to red. That should be the other way around.
I've included the updated files...
When I'm starting LinuxCNC it starts with a 'green' fan, that should be red/off.
Also, It's not a button yet.
When I start the program, the fan changes from green to red. That should be the other way around.
I've included the updated files...
Last edit: 16 Feb 2022 09:51 by remon_v.
Please Log in or Create an account to join the conversation.
16 Feb 2022 10:15 - 16 Feb 2022 10:16 #235024
by rodw
Replied by rodw on topic Fans to turn on when starting program
You can use the not component to invert the signal. Type man not to learn more.
Last edit: 16 Feb 2022 10:16 by rodw.
Please Log in or Create an account to join the conversation.
16 Feb 2022 10:55 - 16 Feb 2022 11:05 #235029
by remon_v
Replied by remon_v on topic Fans to turn on when starting program
Thanks rodw,
It's not the signal I wanted to invert, but the image showing.
I've got that fixed now:
I've changed this line in custompanel.xml:
<image_bit halpin="selectimage" images="fanon fanoff"/>
Into this line:
<image_bit halpin="selectimage" images="fanoff fanon"/>
I also checked in Hal show/watch if the pin is trigerred, and it is when the program is running. Also the fan turns red, so that also works.
The only thing that is not working yet, is to manually control the fans off and on. And I also want to disable the manual control when the program is running. So I think the 'or' function is not correct, but some other function.
I'm guessing the 'mux' command?
It's not the signal I wanted to invert, but the image showing.
I've got that fixed now:
I've changed this line in custompanel.xml:
<image_bit halpin="selectimage" images="fanon fanoff"/>
Into this line:
<image_bit halpin="selectimage" images="fanoff fanon"/>
I also checked in Hal show/watch if the pin is trigerred, and it is when the program is running. Also the fan turns red, so that also works.
The only thing that is not working yet, is to manually control the fans off and on. And I also want to disable the manual control when the program is running. So I think the 'or' function is not correct, but some other function.
I'm guessing the 'mux' command?
Last edit: 16 Feb 2022 11:05 by remon_v.
Please Log in or Create an account to join the conversation.
16 Feb 2022 11:35 #235033
by remon_v
Replied by remon_v on topic Fans to turn on when starting program
Oke 1 step further... I've added the 'check button' and it works fine.
Now when I manually push the 'check button' the 'red fan' doesn't turn green, how to fix this?
Also I want to not be able manually control the fans when the program runs (see post above)
Now when I manually push the 'check button' the 'red fan' doesn't turn green, how to fix this?
Also I want to not be able manually control the fans when the program runs (see post above)
Please Log in or Create an account to join the conversation.
16 Feb 2022 17:33 - 16 Feb 2022 19:45 #235055
by MaHa
Replied by MaHa on topic Fans to turn on when starting program
I would use a button, then you can disable it when program is running, using the disable pin. As it is momentary, you need toggle. The inverted 'halui.mode.is-mdi' enables the button.
I was not able to test this, but at least there is an idea to solve that.
[/code]
<pyvcp>
<button>
<halpin>"fans-button"</halpin>
<disable_pin>True</disable_pin>
<text>"FAN"</text>
</button>
</pyvcp>
[code]loadrt or2
addf or2.0 servo-thread
loadrt toggle
addf toggle.0 servo-thread
net fans-auto halui.mode.is-auto
net fans-auto pyvcp.fans-button.disable
net fans-auto => or2.0.in0
net trig-button pyvcp.fans-button toggle.0.in
net tog-button toggle.0.out => or2.0.in1
net fans or2.0.out => parport.0.pin-17-out
Last edit: 16 Feb 2022 19:45 by MaHa.
Please Log in or Create an account to join the conversation.
16 Feb 2022 18:58 #235062
by remon_v
Replied by remon_v on topic Fans to turn on when starting program
Thanks MaHa for the reply!
I tried your code, but it's giving an error on the pyvcp.fans-button.disable
So I guess I have to add this to the 99-postgui.hal?
I added this line to the 99-postgui.hal file but no luck:
net button.disable pyvcp.fans-button.disable => not.0.out
I tried your code, but it's giving an error on the pyvcp.fans-button.disable
So I guess I have to add this to the 99-postgui.hal?
I added this line to the 99-postgui.hal file but no luck:
net button.disable pyvcp.fans-button.disable => not.0.out
Please Log in or Create an account to join the conversation.
16 Feb 2022 19:38 #235068
by MaHa
Replied by MaHa on topic Fans to turn on when starting program
I updated the code above, fixed a minor error.
<disable_pin>True</disable_pin> was missing in the .xml file, and check for mdi-mode was unnecessary/faulty.
<disable_pin>True</disable_pin> was missing in the .xml file, and check for mdi-mode was unnecessary/faulty.
Please Log in or Create an account to join the conversation.
Time to create page: 0.082 seconds