Listening Reef
- jsclownfish
- Posts: 378
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Listening Reef
I've finally got back to this fun little DIY addon. I've added new functionality like "feed the fish" with the autofeeder and "water change" which is kind of fun. I want to have a simple "default status" and an "all off" to control all the ports at once. I'm using this basic code (thanks Roberto!) now....
Is there an easier way to turn everything off or set everything to auto status without running through each port and setting them using masks?
Thanks,
Jon
Code: Select all
GetVR();
if (vrrelay >0)
{
if (vrtype==0) // Turn port off
{
bitClear(ReefAngel.Relay.RelayMaskOn,vrrelay-1);
bitClear(ReefAngel.Relay.RelayMaskOff,vrrelay-1);
}
else if (vrtype==1) // Turn port on
{
bitSet(ReefAngel.Relay.RelayMaskOn,vrrelay-1);
bitSet(ReefAngel.Relay.RelayMaskOff,vrrelay-1);
}
else if (vrtype==2) // Turn port Auto
{
bitClear(ReefAngel.Relay.RelayMaskOn,vrrelay-1);
bitSet(ReefAngel.Relay.RelayMaskOff,vrrelay-1);
}
}
Thanks,
Jon
Re: Listening Reef
Try this:
Code: Select all
ReefAngel.Relay.RelayMaskOn=0;
ReefAngel.Relay.RelayMaskOff=255;
Roberto.
- jsclownfish
- Posts: 378
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Listening Reef
Does that code for resetting the status to all auto settings or all off? (or one each?) I think I remember there was a function in the relay class of ReefAngel.Relay.AllOff that would turn everything off?
Thanks,
Jon
Thanks,
Jon
Re: Listening Reef
The code is to set everything back to auto.
You can use the AllOff to turn everything off, or go directly to the relay variable:
You can use the AllOff to turn everything off, or go directly to the relay variable:
Code: Select all
ReefAngel.Relay.RelayData=0;
Roberto.