Override and Mask

New members questions
Post Reply
Diverjoe
Posts: 26
Joined: Thu Nov 24, 2016 7:19 am

Override and Mask

Post by Diverjoe »

Can someone help me understand what/how Override and Mask works with regards to relays? What is it for and how is it used?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Override and Mask

Post by rimai »

Override gives you the ability to turn relays on/off regardless of what your code says it should be.
Let's say you have a relay set for heater. It will turn on/off based in temperature.
If you for some reason would like to turn the heater off, you use the mask to turn it off and it will stay off as long as the override is set. Clear the override to return back to normal.
Roberto.
Diverjoe
Posts: 26
Joined: Thu Nov 24, 2016 7:19 am

Re: Override and Mask

Post by Diverjoe »

"you use the mask" - is that the mask or the override?
1.) So the heater is set with the automatic out of the box on/off function (from the wizard)
2.) Some problem is detected in code maybe
3.) ReefAngel.Relay.Override(heater_port);
4.) Heater stays off forever until Override is overridden
5.) How does that happen?
6.) Is Override the "mask"? ReefAngel.Relay.IsMaskOn(heater_port) is true after #3
7.) or Do you set masks directly
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Override and Mask

Post by rimai »

You may want to look at the source code to see what the underlying libraries are doing.
https://github.com/reefangel/Libraries/ ... /Relay.cpp
The override function does nothing more than set/clear bits on the MaskOff and MaskOn variables.
You can also set/clear the bits yourself if you choose, but it is easier to use the Override function.
Roberto.
Post Reply