Fans to turn on when starting program

More
4 years 8 months ago #234971 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!
 

Please Log in to join the conversation.

More
4 years 8 months ago #234974 by MaHa
When program running, 'halui.mode.is-auto' is true
Code:
net modauto halui.mode.is-auto

replace this line
Code:
net fans-gcode motion.digital-out-00 => or2.0.in0

by
Code:
net modauto => or2.0.in0

this toggles the 2 gifs of the fan
Code:
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
            
Code:
<image name='fanon' file='fanon.gif'/> <image name='fanof' file='fanof.gif'/> <vbox>     <image_bit halpin='selectimage' images='fanon fanof'/> </vbox>
 

Please Log in to join the conversation.

More
4 years 8 months ago #234990 by remon_v
Thanks for the quick reply!
I will try it out in the morning…

Please Log in to join the conversation.

More
4 years 8 months ago #235021 by remon_v
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...
 

Please Log in to join the conversation.

More
4 years 8 months ago #235024 by rodw
You can use the not component to invert the signal. Type man not to learn more.

Please Log in to join the conversation.

More
4 years 8 months ago #235029 by remon_v
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?

Please Log in to join the conversation.

More
4 years 8 months ago #235033 by remon_v
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)

Please Log in to join the conversation.

More
4 years 8 months ago #235055 by MaHa
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
[/code]

Please Log in to join the conversation.

More
4 years 8 months ago #235062 by remon_v
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

Please Log in to join the conversation.

More
4 years 8 months ago #235068 by MaHa
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.

Please Log in to join the conversation.

Time to create page: 0.065 seconds
Powered by Kunena Forum