Page 2 of 2
Re: Completely lost!
Posted: Fri Apr 06, 2012 12:45 am
by chort55
Ok so I had to replace my main board, and pwm module.... so I had to redo all this code.......... and now its not working right and throwing errors! And I am just trying to upload the Initial Memory code
Code: Select all
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <Time.h>
#include <OneWire.h>
#include <RA_NokiaLCD.h>
#include <avr/pgmspace.h>
#include <InternalEEPROM.h>
#include <Wire.h>
#include <Memory.h>
RA_NokiaLCD e;
void setup()
{
e.Init();
e.Clear(COLOR_WHITE,0,0,132,132);
e.BacklightOn();
InternalMemory.MHOnHour_write(15);
InternalMemory.MHOnMinute_write(30);
InternalMemory.MHOffHour_write(21);
InternalMemory.MHOffMinute_write(0);
InternalMemory.MHDelay_write(7);
InternalMemory.StdLightsOnHour_write(14);
InternalMemory.StdLightsOnMinute_write(0);
InternalMemory.StdLightsOffHour_write(21);
InternalMemory.StdLightsOffMinute_write(30);
InternalMemory.DP1OnHour_write(20);
InternalMemory.DP1OnMinute_write(0);
InternalMemory.DP2OnHour_write(22);
InternalMemory.DP2OnMinute_write(30);
InternalMemory.DP1Timer_write(4);
InternalMemory.DP2Timer_write(4);
InternalMemory.DP1RepeatInterval_write(60);
InternalMemory.DP2RepeatInterval_write(60);
InternalMemory.ATOTimeout_write(60);
InternalMemory.ATOHighTimeout_write(60);
InternalMemory.ATOHourInterval_write(0);
InternalMemory.ATOHighHourInterval_write(0);
InternalMemory.FeedingTimer_write(900);
InternalMemory.LCDTimer_write(600);
InternalMemory.LEDPWMActinic_write(20);
InternalMemory.LEDPWMDaylight_write(20);
InternalMemory.WM1Timer_write(10);
InternalMemory.WM2Timer_write(15);
InternalMemory.HeaterTempOn_write(766);
InternalMemory.HeaterTempOff_write(770);
InternalMemory.ChillerTempOn_write(774);
InternalMemory.ChillerTempOff_write(770);
InternalMemory.OverheatTemp_write(1500);
InternalMemory.PHMax_write(830);
InternalMemory.PHMin_write(540);
InternalMemory.SalMax_write(2550);
InternalMemory.RFMode_write(Constant);
InternalMemory.RFSpeed_write(140);
InternalMemory.RFDuration_write(8);
InternalMemory.RFDuration_write(8);
InternalMemory.PWMSlopeStartD_write(15);
InternalMemory.PWMSlopeEndD_write(100);
InternalMemory.PWMSlopeDurationD_write(60);
InternalMemory.PWMSlopeStartA_write(15);
InternalMemory.PWMSlopeEndA_write(100);
InternalMemory.PWMSlopeDurationA_write(60);
InternalMemory.IMCheck_write(0x5241494D);
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL+20, MENU_START_ROW*3, "Memory Updated");
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL+25, MENU_START_ROW*6, "You can now");
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL+25, MENU_START_ROW*7, "upload your");
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL+33, MENU_START_ROW*8, "INO code");
}
void loop()
{
}
color white is not declared for this scope,
color black is not declared for this scope,
RA_customcolors.h no such file or directory
I don't know what I did wrong this time but I thought I went through everything like last time when it was all working... even updated the libraries after continuously getting this error... still doesnt help.
Re: Completely lost!
Posted: Fri Apr 06, 2012 12:47 am
by chort55
I even came in here, grabbed my old code that wont load, tried a new one through RAgen that won't load... well the ino wont for same error... but I am able to do a regular RAgen code... but will that work doing it like that... power outage will reset defaults or something wont it?
Re: Completely lost!
Posted: Fri Apr 06, 2012 1:39 am
by chort55
Well I decided to try to delete EVERYTHING, did that, now its claiming its loading fine w/o error.... but its not changing anything!
When I upload the new RAgen memory code it doesn't give me the screen to upload the pde code, and uploading either code does not change anything!
Re: Completely lost!
Posted: Fri Apr 06, 2012 2:14 am
by chort55
And problem was solved by slightly loosening the cable from the relay box to the display unit..... yeah I don't get it either lol
But I got all my code reloaded and seems to be ok now. Also the LED on the PWM module is lit up now as well!
Re: Completely lost!
Posted: Fri Apr 06, 2012 3:21 pm
by binder
Good job. Glad you got it figured out.
Re: Completely lost!
Posted: Sat Apr 07, 2012 8:59 pm
by chort55
Well, the problem with the screen freezing up has returned. It only happens when my lights should turn on/ or off (I am thinking it may be related to the led code as I notice it around when they should come on, ramp up or down or shut off.
Here is my internal memory code:
Code: Select all
// Autogenerated file by RAGen (v1.2.2.171), (04/07/2012 18:05)
// Memory_040712_1805.ino
//
// This file sets the default values to the Internal Memory
//
#include <ReefAngel_Features.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Globals.h>
#include <Time.h>
#include <OneWire.h>
#include <RA_NokiaLCD.h>
#include <avr/pgmspace.h>
#include <InternalEEPROM.h>
#include <Wire.h>
#include <Memory.h>
RA_NokiaLCD e;
void setup()
{
e.Init();
e.Clear(COLOR_WHITE,0,0,132,132);
e.BacklightOn();
InternalMemory.MHOnHour_write(16);
InternalMemory.MHOnMinute_write(0);
InternalMemory.MHOffHour_write(23);
InternalMemory.MHOffMinute_write(59);
InternalMemory.StdLightsOnHour_write(16);
InternalMemory.StdLightsOnMinute_write(15);
InternalMemory.StdLightsOffHour_write(23);
InternalMemory.StdLightsOffMinute_write(45);
InternalMemory.DP1Timer_write(10);
InternalMemory.DP2Timer_write(10);
InternalMemory.FeedingTimer_write(845);
InternalMemory.LCDTimer_write(600);
InternalMemory.OverheatTemp_write(800);
InternalMemory.LEDPWMDaylight_write(0);
InternalMemory.LEDPWMActinic_write(0);
InternalMemory.HeaterTempOn_write(754);
InternalMemory.HeaterTempOff_write(757);
InternalMemory.ChillerTempOn_write(759);
InternalMemory.ChillerTempOff_write(758);
InternalMemory.ATOTimeout_write(60);
InternalMemory.PHMax_write(840);
InternalMemory.PHMin_write(550);
InternalMemory.MHDelay_write(5);
InternalMemory.DP1OnHour_write(20);
InternalMemory.DP1OnMinute_write(0);
InternalMemory.DP2OnHour_write(22);
InternalMemory.DP2OnMinute_write(30);
InternalMemory.ATOHourInterval_write(0);
InternalMemory.ATOHighHourInterval_write(0);
InternalMemory.ATOHighTimeout_write(60);
InternalMemory.DP1RepeatInterval_write(0);
InternalMemory.DP2RepeatInterval_write(0);
InternalMemory.SalMax_write(2550);
InternalMemory.PWMSlopeStartD_write(15);
InternalMemory.PWMSlopeEndD_write(100);
InternalMemory.PWMSlopeDurationD_write(60);
InternalMemory.PWMSlopeStartA_write(15);
InternalMemory.PWMSlopeEndA_write(100);
InternalMemory.PWMSlopeDurationA_write(60);
InternalMemory.RFMode_write(0);
InternalMemory.RFSpeed_write(100);
InternalMemory.RFDuration_write(10);
InternalMemory.PWMSlopeStart0_write(15);
InternalMemory.PWMSlopeEnd0_write(100);
InternalMemory.PWMSlopeDuration0_write(60);
InternalMemory.PWMSlopeStart1_write(15);
InternalMemory.PWMSlopeEnd1_write(100);
InternalMemory.PWMSlopeDuration1_write(60);
InternalMemory.PWMSlopeStart2_write(15);
InternalMemory.PWMSlopeEnd2_write(100);
InternalMemory.PWMSlopeDuration2_write(60);
InternalMemory.PWMSlopeStart3_write(15);
InternalMemory.PWMSlopeEnd3_write(100);
InternalMemory.PWMSlopeDuration3_write(60);
InternalMemory.PWMSlopeStart4_write(15);
InternalMemory.PWMSlopeEnd4_write(100);
InternalMemory.PWMSlopeDuration4_write(60);
InternalMemory.PWMSlopeStart5_write(15);
InternalMemory.PWMSlopeEnd5_write(100);
InternalMemory.PWMSlopeDuration5_write(60);
InternalMemory.IMCheck_write(0x5241494D);
}
void loop()
{
// display success screen
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, "Internal Memory Set");
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*4, "Now load your");
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, " RA code file");
delay(5000);
}
Here is my RA code:
Code: Select all
/* The following features are enabled for this File:
#define WavemakerSetup
#define DateTimeSetup
#define MetalHalideSetup
#define DisplayLEDPWM
#define StandardLightSetup
#define SaveRelayState
#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.Wavemaker1(Port5);
ReefAngel.Wavemaker2(Port6);
ReefAngel.StandardHeater(Port7);
// PWMSlope based on Internal Memory values for Standard Lights
ReefAngel.PWM.ActinicPWMSlope();
ReefAngel.PWM.DaylightPWMSlope();
////// Place your custom code below here
ReefAngel.WavemakerRandom1(Port5,15,60); // Turn Port5 on/off random cycles that lasts from 15 to 60 secs
ReefAngel.WavemakerRandom2(Port6,15,60); // Turn Port6 on/off random cycles that lasts from 15 to 60 secs
////// Place your custom code above here
ReefAngel.ShowInterface();
}
Re: Completely lost!
Posted: Sat Apr 07, 2012 9:06 pm
by chort55
I haven't pulled them on the new board to check yet, but I am going to assume that if I pull the jumpers like on the old one the problem will stop like it did on the last one since it is the same issue.
I am guessing the reasoning behind this would be that w/ the jumpers removed the display board doesn't deal with the PWM module stuff since it doesn't read it being there, and I don't see how w/ different jumpers, board and pwm module that the same issue would arise w/o it being something with the code, atleast somewhat.
Also, if I manually set the PWM level to 100% it spazzes out and just rolls #'s for the values of all the channels. Thankfully I don't have my led's hooked up to it yet, my wrasses would FLIP! Its bad enough I have had to keep unplugging and resetting the controller to keep the powerheads flowing.
Re: Completely lost!
Posted: Sat Apr 07, 2012 9:21 pm
by rimai
Yes, if you pull them, the controller won't be talking to the PWM expansion module.
And you don't even have any drivers connected to the module correct?
Do you have any of the communication cables running close to any ballast??
Re: Completely lost!
Posted: Sat Apr 07, 2012 9:23 pm
by chort55
Drivers are not connected since I still don't have them. I did have the new module plugged in today, and the led inside still lights up FWIW.
The ballast themselves, no. Power cords for the ballasts yes, those are plugged into the relay box as I am running t5's on the tank now.
Also, now I am noticing (because I made some changes probably) that my ports 5 and 6 sometimes kick on and off instantly instead of randomly between 15 and 60 seconds like they should. I pulled their code from the INO file because it wasn't changing them randomly then it was going with their the set time changes I had from before and added the random code. Notice anything there?
Re: Completely lost!
Posted: Sat Apr 07, 2012 9:33 pm
by rimai
Worth a try.
Move the head unit and the communication cable away from the ballast and see if it makes any difference.
Also, enable watchdog timer on the features tab of ragen, click save and upload your code again.
Re: Completely lost!
Posted: Sat Apr 07, 2012 9:36 pm
by chort55
With the watchdog timer on, will that cause my lights to potentially pop on/ off? That was my initial reason for not wanting to turn that on as my wrasses freak out and I don't exactly want my delicate leopards to do that
Re: Completely lost!
Posted: Sat Apr 07, 2012 9:55 pm
by chort55
Ok, here is the new RA code
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.ActinicPWMSlope();
ReefAngel.PWM.DaylightPWMSlope();
////// Place your custom code below here
ReefAngel.WavemakerRandom1(Port5,17,57); // Turn Port5 on/off random cycles that lasts from 17 to 57 secs
ReefAngel.WavemakerRandom2(Port6,21,60); // Turn Port6 on/off random cycles that lasts from 21 to 60 secs
////// Place your custom code above here
// This should always be the last line
ReefAngel.ShowInterface();
}
I found and corrected the issue with the wavemaker w/ this code as well. Since I pulled them out of the memory file, I needed to take them out of this code under the uses internal memory values section and didn't until this update.
I also enabled the WDT, but still wonder about the light flicker.
I have the controller in a different room connected to the laptop for changing the code and I set the PWM to 100% (and it is unhooked) and it is still scrolling different values which continues to make me think I have a coding error surrounding the leds/ pwm somewhere... maybe something doubled up causing the confusion? Or maybe something similar to the wavemaker issue and codes from the internal memory code and the RA/pde codes clashing?
Re: Completely lost!
Posted: Mon Apr 09, 2012 9:14 am
by rimai
Code: Select all
ReefAngel.PWM.ActinicPWMSlope();
ReefAngel.PWM.DaylightPWMSlope();
The code above is supposed to create a PWM slope on both actinic and daylight channels.
They are not a constant 100%
To make them constant 100%, use this:
Code: Select all
ReefAngel.PWM.SetActinic(100);
ReefAngel.PWM.SetDaylight(100);
Re: Completely lost!
Posted: Mon Apr 09, 2012 9:18 am
by chort55
rimai wrote:Code: Select all
ReefAngel.PWM.ActinicPWMSlope();
ReefAngel.PWM.DaylightPWMSlope();
The code above is supposed to create a PWM slope on both actinic and daylight channels.
They are not a constant 100%
To make them constant 100%, use this:
Code: Select all
ReefAngel.PWM.SetActinic(100);
ReefAngel.PWM.SetDaylight(100);
I have the slope in my internal memory file I believe. I was refering to when I manually set the controller to put them at 100%, or 50% even it does the same thing and just rolls through #s on the display for the PWM module.
Re: Completely lost!
Posted: Mon Apr 09, 2012 9:20 am
by chort55
Here is the internal memory code for the PWM module:
Code: Select all
InternalMemory.PWMSlopeStartD_write(15);
InternalMemory.PWMSlopeEndD_write(100);
InternalMemory.PWMSlopeDurationD_write(60);
InternalMemory.PWMSlopeStartA_write(15);
InternalMemory.PWMSlopeEndA_write(100);
InternalMemory.PWMSlopeDurationA_write(60);
InternalMemory.RFMode_write(0);
InternalMemory.RFSpeed_write(100);
InternalMemory.RFDuration_write(10);
InternalMemory.PWMSlopeStart0_write(15);
InternalMemory.PWMSlopeEnd0_write(100);
InternalMemory.PWMSlopeDuration0_write(60);
InternalMemory.PWMSlopeStart1_write(15);
InternalMemory.PWMSlopeEnd1_write(100);
InternalMemory.PWMSlopeDuration1_write(60);
InternalMemory.PWMSlopeStart2_write(15);
InternalMemory.PWMSlopeEnd2_write(100);
InternalMemory.PWMSlopeDuration2_write(60);
InternalMemory.PWMSlopeStart3_write(15);
InternalMemory.PWMSlopeEnd3_write(100);
InternalMemory.PWMSlopeDuration3_write(60);
InternalMemory.PWMSlopeStart4_write(15);
InternalMemory.PWMSlopeEnd4_write(100);
InternalMemory.PWMSlopeDuration4_write(60);
InternalMemory.PWMSlopeStart5_write(15);
InternalMemory.PWMSlopeEnd5_write(100);
InternalMemory.PWMSlopeDuration5_write(60);
Do I still need to set something in the RA file for them as well?
Re: Completely lost!
Posted: Mon Apr 09, 2012 9:21 am
by rimai
yes
Re: Completely lost!
Posted: Mon Apr 09, 2012 9:21 am
by rimai
Let me put them together for you. We still don't have a condensed version.
Re: Completely lost!
Posted: Mon Apr 09, 2012 9:39 am
by rimai
Add this to your code:
Code: Select all
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()
));
Re: Completely lost!
Posted: Tue Apr 10, 2012 6:07 am
by chort55
Just to make sure, that is supposed to go in my RA/ pde code correct?
Re: Completely lost!
Posted: Tue Apr 10, 2012 7:45 am
by rimai
Yes
Re: Completely lost!
Posted: Thu Apr 19, 2012 10:35 pm
by chort55
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();
}
Re: Completely lost!
Posted: Fri Apr 20, 2012 7:49 am
by rimai
It's a bug!!!
Thanks for informing.
I've located it and will include in the next library release.
Re: Completely lost!
Posted: Fri Apr 20, 2012 8:11 am
by chort55
Ok cool I am just glad to know I didnt screw something up LOL!!!!!!!
Any idea on a release date?
Thanks again for all your help Roberto!