menus and lights

Do you have a question on how to do something.
Ask in here.
Post Reply
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

menus and lights

Post by rossbryant1956 »

I am picking apart some code and using the pieces I like. Please explain to me what this does:

Code: Select all

// Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = 0;
  ReefAngel.LightsOnPortsE[0] = Port1Bit | Port2Bit | Port3Bit;
It looks like when a menu toggle is pressed it only turns off lights on the second outlet box. I will have lights on both of my outlet boxes. It obviously goes with this section:

Code: Select all

void DrawCustomMain()
{
  int x,y;
  char text[10];
  // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
  pingSerial();

  // Main Relay Box
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox( 12, 93, TempRelay );
  pingSerial();

  // Relay Expansion
  TempRelay = ReefAngel.Relay.RelayDataE[0];
  TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
  TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
  ReefAngel.LCD.DrawOutletBox( 12, 107, TempRelay );
  pingSerial();

  // Date and Time
  ReefAngel.LCD.DrawDate( 6, 122 );
  pingSerial();
}

void DrawCustomGraph()
{
  ReefAngel.LCD.DrawGraph( 5, 5 );
}
I am still brand new at menus, so thanks in advance. BTW I am not using any of my LED\PWM ports at this time so if I don't need that part pls advise. Thx
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: menus and lights

Post by rimai »

It tells the controller which ports will be used as lights.
If you have lights on both boxes, you need to set the correct bits for each box.
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: menus and lights

Post by rossbryant1956 »

So then if I have lights on both boxes I need:

Code: Select all

// Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = 0;
  ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit;
  ReefAngel.LightsOnPortsE[0] = Port1Bit | Port2Bit | Port3Bit;
This look right? Thx
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: menus and lights

Post by rimai »

That works, but you can also remove this redundant code, because you are assigning a value to that same variable on the very next line.

Code: Select all

ReefAngel.LightsOnPorts = 0;
Roberto.
Post Reply