Well I got my drivers in today so I have been able to give this a shot with the actual lights finally.... Recoded it to the new code you gave me Roberto (tested it off the controllers PWM port to tune the driver, got one tuned in (meanwell 60-48P) ran fine at 100% (@760mA).... plug it into the PWM module, and its showing they are at 38 (but should be off), if I change the time to when they should be on it shows 255.... this doesn't seem correct! Also, I have lost the ability to change their settings manually from the menu like I used to be able to!
So heres the RA code (I didnt change the memory code from the last posting of it at all), can you tell me what I screwed up now?
Code: Select all
/* The following features are enabled for this File:
#define WavemakerSetup
#define DateTimeSetup
#define MetalHalideSetup
#define DisplayLEDPWM
#define StandardLightSetup
#define SaveRelayState
#define WDT
#define PWMEXPANSION
#define CUSTOM_MAIN
#define COLORS_PDE
*/
#include <ReefAngel_Features.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <ReefAngel.h>
byte x,y;
char text[10];
////// Place global variable code below here
////// Place global variable code above here
void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.Clear(BtnActiveColor,5,0,127,11);
ReefAngel.LCD.DrawText(DefaultBGColor,BtnActiveColor,30,3,"Chris' 180g");
ReefAngel.LCD.DrawDate(6, 122);
pingSerial();
ReefAngel.LCD.DrawMonitor(15, 20, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
pingSerial();
ReefAngel.LCD.Clear(DefaultFGColor,5,52,127,52);
ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,30,55,"PWM Expansion");
x=15;
y=68;
for (int a=0;a<6;a++)
{
if (a>2) x=75;
if (a==3) y=68;
ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :");
ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a);
ConvertNumToString(text, ReefAngel.PWM.GetChannelValue(a), 1);
strcat(text," ");
ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,text);
y+=10;
}
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 103, TempRelay);
}
void DrawCustomGraph()
{
}
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port7Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit;
// Ports that are always on
ReefAngel.Relay.On(Port8);
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
// Specific functions that use Internal Memory values
ReefAngel.MHLights(Port1);
ReefAngel.StandardLights(Port2);
ReefAngel.StandardLights(Port3);
ReefAngel.StandardFan(Port4);
if (ReefAngel.Relay.Status(Port2)) ReefAngel.Relay.On(Port4);
ReefAngel.StandardHeater(Port7);
// PWMSlope based on Internal Memory values for Standard Lights
ReefAngel.PWM.SetChannel(0,PWMSlope(
InternalMemory.StdLightsOnHour_read(),
InternalMemory.StdLightsOnMinute_read(),
InternalMemory.StdLightsOffHour_read(),
InternalMemory.StdLightsOffMinute_read(),
InternalMemory.PWMSlopeStart0_read(),
InternalMemory.PWMSlopeEnd0_read(),
InternalMemory.PWMSlopeDuration0_read(),
InternalMemory.PWMSlopeStart0_read()
));
ReefAngel.PWM.SetChannel(1,PWMSlope(
InternalMemory.StdLightsOnHour_read(),
InternalMemory.StdLightsOnMinute_read(),
InternalMemory.StdLightsOffHour_read(),
InternalMemory.StdLightsOffMinute_read(),
InternalMemory.PWMSlopeStart1_read(),
InternalMemory.PWMSlopeEnd1_read(),
InternalMemory.PWMSlopeDuration1_read(),
InternalMemory.PWMSlopeStart1_read()
));
ReefAngel.PWM.SetChannel(2,PWMSlope(
InternalMemory.StdLightsOnHour_read(),
InternalMemory.StdLightsOnMinute_read(),
InternalMemory.StdLightsOffHour_read(),
InternalMemory.StdLightsOffMinute_read(),
InternalMemory.PWMSlopeStart2_read(),
InternalMemory.PWMSlopeEnd2_read(),
InternalMemory.PWMSlopeDuration2_read(),
InternalMemory.PWMSlopeStart2_read()
));
ReefAngel.PWM.SetChannel(3,PWMSlope(
InternalMemory.StdLightsOnHour_read(),
InternalMemory.StdLightsOnMinute_read(),
InternalMemory.StdLightsOffHour_read(),
InternalMemory.StdLightsOffMinute_read(),
InternalMemory.PWMSlopeStart3_read(),
InternalMemory.PWMSlopeEnd3_read(),
InternalMemory.PWMSlopeDuration3_read(),
InternalMemory.PWMSlopeStart3_read()
));
ReefAngel.PWM.SetChannel(4,PWMSlope(
InternalMemory.StdLightsOnHour_read(),
InternalMemory.StdLightsOnMinute_read(),
InternalMemory.StdLightsOffHour_read(),
InternalMemory.StdLightsOffMinute_read(),
InternalMemory.PWMSlopeStart4_read(),
InternalMemory.PWMSlopeEnd4_read(),
InternalMemory.PWMSlopeDuration4_read(),
InternalMemory.PWMSlopeStart4_read()
));
ReefAngel.PWM.SetChannel(5,PWMSlope(
InternalMemory.StdLightsOnHour_read(),
InternalMemory.StdLightsOnMinute_read(),
InternalMemory.StdLightsOffHour_read(),
InternalMemory.StdLightsOffMinute_read(),
InternalMemory.PWMSlopeStart5_read(),
InternalMemory.PWMSlopeEnd5_read(),
InternalMemory.PWMSlopeDuration5_read(),
InternalMemory.PWMSlopeStart5_read()
));
////// Place your custom code below here
ReefAngel.WavemakerRandom1(Port5,17,47); // Turn Port5 on/off random cycles that lasts from 17 to 47 secs
ReefAngel.WavemakerRandom2(Port6,31,51); // Turn Port6 on/off random cycles that lasts from 31 to 51 secs
////// Place your custom code above here
// This should always be the last line
ReefAngel.ShowInterface();
}