If Port On Then

Do you have a question on how to do something.
Ask in here.
Post Reply
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: If Port On Then

Post by lnevo »

clw143 wrote:Right, I follow, BUT then why does the wizard make a Port8Bit? It should not exist. For my water change mode above, ports 3-8 are off and Port3Bit - Port8Bit are specified.

I have version 1.0.9

It has no idea what IsMaskOn is.
I'm 99.9% sure its in there. Let me verify the syntax. I just saw someone post code that was using it at 1.0.9
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: If Port On Then

Post by lnevo »

It is in the stock 1.0.9 I just confirmed.

Take a look at the class definition for Relay.

http://www.easte.net/RA/html/class_relay_class.html#

The syntax should be:

Code: Select all

ReefAngel.Relay.IsMaskOn(PortX);
or

Code: Select all

ReefAngel.Relay.IsMaskOff(PortX);
Make sure to change X :)
clw143
Posts: 118
Joined: Fri Jun 21, 2013 8:20 pm
Location: Louisiana

Re: If Port On Then

Post by clw143 »

I was having some weird results and changed the code to this

Code: Select all

  // Dimmable royal blues 100% if actinics (relay port 2) are on, else moonlight
  if (bitRead(ReefAngel.Relay.RelayMaskOn, Port1Bit)) ReefAngel.PWM.SetActinic( 100 );
  else ReefAngel.PWM.SetActinic( MoonPhase()/2 );
Moonlights should be 100% if port 2 is on, and that is quite literally how it is working, if it is in "auto" or "off" it is in moonlight mode, if "on" it is 100%

How do I get them to work right in auto?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: If Port On Then

Post by rimai »

Use RelayData instead of RelayMaskOn
Roberto.
clw143
Posts: 118
Joined: Fri Jun 21, 2013 8:20 pm
Location: Louisiana

Re: If Port On Then

Post by clw143 »

lnevo wrote:It is in the stock 1.0.9 I just confirmed.

Take a look at the class definition for Relay.

http://www.easte.net/RA/html/class_relay_class.html#

The syntax should be:

Code: Select all

ReefAngel.Relay.IsMaskOn(PortX);
or

Code: Select all

ReefAngel.Relay.IsMaskOff(PortX);
Make sure to change X :)
I try this:

Code: Select all

  // Dimmable royal blues 100% if actinics (relay port 2) are on, else moonlight
  if (ReefAngel.Relay.IsMaskOn(Port2);) ReefAngel.PWM.SetActinic( 100 );
  else ReefAngel.PWM.SetActinic( MoonPhase()/2 );
Error says: 'class RelayClass' has no member named 'IsMaskOn'
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: If Port On Then

Post by rimai »

Humm..
That may have been my fault.
I think I forgot to add the entries in the features.txt file.
Hey Lee, can you create an issue and include the entries that need to added?
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: If Port On Then

Post by lnevo »

Its a lowercase is...sorry

ReefAngel.Relay.isMaskOn(Port)

My bad, no feature.txt required.
clw143
Posts: 118
Joined: Fri Jun 21, 2013 8:20 pm
Location: Louisiana

Re: If Port On Then

Post by clw143 »

This works
rimai wrote:Use RelayData instead of RelayMaskOn

This is still off for auto when auto is on and off for off, and on for on. I need on when auto on. (if that's not a confusing statement)

Code: Select all

  // Dimmable royal blues 100% if actinics (relay port 2) are on, else moonlight
  if (ReefAngel.Relay.isMaskOn(Port2)) ReefAngel.PWM.SetActinic( 100 );
  else ReefAngel.PWM.SetActinic( MoonPhase()/5 );
Post Reply