PWM Dimming Expansion

Expansion modules and attachments
Post Reply
clw143
Posts: 116
Joined: Fri Jun 21, 2013 8:20 pm
Location: Louisiana

PWM Dimming Expansion

Post by clw143 »

So if I add this to my code I can control from portal.

Code: Select all

  ReefAngel.PWM.Channel0PWMParabola();
  ReefAngel.PWM.Channel1PWMParabola();
  ReefAngel.PWM.Channel2PWMParabola();
  ReefAngel.PWM.Channel3PWMParabola();
  ReefAngel.PWM.Channel4PWMParabola();
  ReefAngel.PWM.Channel5PWMParabola();
My best guess all these channels will be like the PWM Actinic channel was and my sunrise and sunset code will be the same for all of them. How do I tell it some of them are daylight and to use the actinic offset?
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: PWM Dimming Expansion

Post by lnevo »

You can give each of those lines an argument for their offset.

If you want to use the Actinic offset variable you can reference it with this function

ReefAngel.InternalMemory.ActinicOffset_read();
clw143
Posts: 116
Joined: Fri Jun 21, 2013 8:20 pm
Location: Louisiana

Re: PWM Dimming Expansion

Post by clw143 »

lnevo wrote:ReefAngel.InternalMemory.ActinicOffset_read();
ReefAngel Class does not have InternalMemory.

You mean do this?

Code: Select all

ReefAngel.PWM.Channel0PWMParabola(InternalMemory.ActinicOffset_read());
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: PWM Dimming Expansion

Post by lnevo »

Yes. Exactly sorry for the mistake :)
clw143
Posts: 116
Joined: Fri Jun 21, 2013 8:20 pm
Location: Louisiana

Re: PWM Dimming Expansion

Post by clw143 »

I don't suppose lights off overheat can apply like they did by port with standard lights?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: PWM Dimming Expansion

Post by rimai »

It doesn't apply, but you can code your own thing.
Something like this:

Code: Select all

if (ReefAngel.Params.Temp[T1_PROBE]>1200)
{
  ReefAngel.PWM.SetChannel(0,0);
}
Roberto.
clw143
Posts: 116
Joined: Fri Jun 21, 2013 8:20 pm
Location: Louisiana

Re: PWM Dimming Expansion

Post by clw143 »

rimai wrote:

Code: Select all

if (ReefAngel.Params.Temp[T1_PROBE]>1200
... make tartar sauce!
clw143
Posts: 116
Joined: Fri Jun 21, 2013 8:20 pm
Location: Louisiana

Re: PWM Dimming Expansion

Post by clw143 »

I also suppose lights on and lights off will work anymore either with out extra code?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: PWM Dimming Expansion

Post by rimai »

Lights On/Off only work for relay ports and standard dimming channels. They do not do anything to the dimming channels.
Roberto.
clw143
Posts: 116
Joined: Fri Jun 21, 2013 8:20 pm
Location: Louisiana

Re: PWM Dimming Expansion

Post by clw143 »

Does something like this work?

Code: Select all

  if ( (ReefAngel.Params.Temp[T1_PROBE]>InternalMemory.OverheatTemp_read()) || (ReefAngel.LightsOff=true) ) ReefAngel.PWM.SetChannel (0,0);
edit: guess not "(did you forget the '&' ?)"
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: PWM Dimming Expansion

Post by rimai »

There is no such thing as ReefAngel.LightsOff
The easiest way is to use the relay port in ReefAngel.LightsOnPort to assign a value to the channel.
This is what I do on mine:

Code: Select all

  if ((ReefAngel.Relay.RelayMaskOn & (1<<(Radion1-1))) == (1<<(Radion1-1))) // If MaskOn, we override PWM to internal memory value
  {
    ReefAngel.RF.SetChannel(Radion_White,InternalMemory.RadionSlopeEndW_read());
    ReefAngel.RF.SetChannel(Radion_RoyalBlue,InternalMemory.RadionSlopeEndRB_read());
    ReefAngel.RF.SetChannel(Radion_Red,InternalMemory.RadionSlopeEndR_read());
    ReefAngel.RF.SetChannel(Radion_Green,InternalMemory.RadionSlopeEndG_read());
    ReefAngel.RF.SetChannel(Radion_Blue,InternalMemory.RadionSlopeEndB_read());
    ReefAngel.RF.SetChannel(Radion_Intensity,InternalMemory.RadionSlopeEndI_read());
  }
  else
  {
    ReefAngel.RF.ChannelWhiteSlope();
    ReefAngel.RF.ChannelRoyalBlueSlope();
    ReefAngel.RF.ChannelRedSlope();
    ReefAngel.RF.ChannelGreenSlope();
    ReefAngel.RF.ChannelBlueSlope();
    ReefAngel.RF.ChannelIntensitySlope();
  }
Roberto.
clw143
Posts: 116
Joined: Fri Jun 21, 2013 8:20 pm
Location: Louisiana

Re: PWM Dimming Expansion

Post by clw143 »

I don't suppose something like this will work?

Code: Select all

ReefAngel.PWM.SetChannel (0&&1&&2&&3&&4&&5,0);
It does compile.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: PWM Dimming Expansion

Post by rimai »

Mathematically, 0&&1&&2&&3&&4&&5 = 0
So, it is the same as this:
ReefAngel.PWM.SetChannel (0,0);
Roberto.
Post Reply