Page 1 of 1

Override and Mask

Posted: Wed Jan 04, 2017 7:22 am
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?

Re: Override and Mask

Posted: Wed Jan 04, 2017 10:33 am
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.

Re: Override and Mask

Posted: Wed Jan 04, 2017 2:20 pm
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

Re: Override and Mask

Posted: Wed Jan 04, 2017 2:51 pm
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.