Override and Mask

New members questions

Posts: 33
Joined: Thu Nov 24, 2016 7:19 am
PostPosted: Wed Jan 04, 2017 7:22 am
Can someone help me understand what/how Override and Mask works with regards to relays? What is it for and how is it used?

Posts: 12279
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Wed Jan 04, 2017 10:33 am
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.

Posts: 33
Joined: Thu Nov 24, 2016 7:19 am
PostPosted: Wed Jan 04, 2017 2:20 pm
"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

Posts: 12279
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Wed Jan 04, 2017 2:51 pm
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.

Return to For New Members

Who is online

Users browsing this forum: No registered users and 2 guests

cron