Custom code, please help

Do you have a question on how to do something.
Ask in here.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom code, please help

Post by rimai »

You must have more than those features shown on your code.
Those defines are just comments from the time the code was generated.
You must have enabled some other feature since then.
Make sure you only use those.
Roberto.
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

I don't know what to do. This is all the code I have. RAgen features

wifi
date/setup
version
display ap/dp
font 8x8

this is the code i'm trying to upload:

/* The following features are enabled for this File:
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define SIMPLE_MENU
#define FONT_8x8
*/
#include <ReefAngel_Features.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 <InternalEEPROM.h>
#include <ReefAngel.h>
void setup()
{
ReefAngel.Init();
ReefAngel.FeedingModePorts = Port4Bit;
ReefAngel.WaterChangePorts = Port3Bit | Port1Bit | Port2Bit | Port7Bit;
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port7Bit;
ReefAngel.LightsOnPorts = 0;
ReefAngel.Relay.On(Port3);
ReefAngel.Relay.On(Port4);
ReefAngel.PHMin=542;
ReefAngel.PHMax=838;
ReefAngel.TempProbe=T1_PROBE;
}
void loop()
{
ReefAngel.StandardLights(Port1,10,0,19,0);
ReefAngel.StandardLights(Port2,22,0,6,0);
ReefAngel.StandardFan(Port5,787,793);
ReefAngel.StandardHeater(Port7,775,785);
ReefAngel.StandardATO(Port8,60);
if (hour() > 6 && hour() < 22)
{
ReefAngel.PWM.SetDaylight(PWMSlope(10,0,18,0,0,80,180,0));
ReefAngel.PWM.SetActinic(PWMSlope(6,0,22,0,0,80,240,0));
}
else
{
ReefAngel.PWM.SetDaylight(PWMSlopeOvernight(22,0,6,0,0,80,240,0));
ReefAngel.PWM.SetActinic(PWMSlopeOvernight(22,0,6,0,0,80,180,0));
}
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200) ReefAngel.Relay.On(Port6);
if (ReefAngel.Params.Temp[T2_PROBE] < 1100 && ReefAngel.Params.Temp[T3_PROBE] < 1100) ReefAngel.Relay.Off(Port6);
ReefAngel.ShowInterface();
}
byte PWMSlopeOvernight(byte startHour, byte startMinute, byte endHour, byte
endMinute, byte startPWM, byte endPWM, byte Duration, byte oldValue)
{
unsigned long Start = previousMidnight(now())+((unsigned long)NumMins(startHour, startMinute)*60);
if (hour()<startHour) Start-=86400;
unsigned long StartD = Start + (Duration*60);
unsigned long End = nextMidnight(now())+((unsigned long)NumMins(endHour, endMinute)*60);
if (hour()<startHour) End-=86400;
unsigned long StopD = End - (Duration*60);
Serial.print(now());
Serial.print("-");
Serial.print(Start);
Serial.print("-");
Serial.print(StartD);
Serial.print("-");
Serial.print(StopD);
Serial.print("-");
Serial.println(End);
if ( now() >= Start && now() <= StartD )
return constrain(map(now(), Start, StartD, startPWM, endPWM),startPWM,
endPWM);
else if ( now() >= StopD && now() <= End )
{
byte v = constrain(map(now(), StopD, End, startPWM, endPWM),startPWM,
endPWM);
return endPWM-v+startPWM;
}
else if ( now() > StartD && now() < StopD )
return endPWM;
return oldValue;
}

Binary sketch size: 33,622 bytes (of a 32,256 byte maximum)
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom code, please help

Post by rimai »

remove the date/time and font8x8
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom code, please help

Post by rimai »

and add simple menu
Roberto.
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

1. I tried reloading my old code and it didn't work
2. I went to a dif laptop and tried to upload the old code ...it worked
3. I tried uploading the latest code from that laptop, it worked
4. I enabled web portal from ragen and tried to reload the code...failed...too big
5. disabled the web portal, save features..reload the code..same error...too big

The good news , your code is working..the PWMSlopeOvernight works
The bad news, I can't compile & upload the code..what to do?


..and 10.0.2.22:200/wifi page is generating massive flood of:
1335312804-1335304800-1335319200-1335319200-1335333600
1335312804-1335304800-1335315600-1335322800-1335333600
1335312804-1335304800-1335319200-1335319200-1335333600
1335312804-1335304800-1335315600-1335322800-1335333600
1335312804-1335304800-1335319200-1335319200-1335333600
1335312804-1335304800-1335315600-1335322800-1335333600
1335312804-1335304800-1335319200-1335319200-1335333600
1335312804-1335304800-1335315600-1335322800-1335333600
1335312804-1335304800-1335319200-1335319200-1335333600
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom code, please help

Post by rimai »

Sorry... My bad... I left stuff in the code that wasn't supposed to be there.
It was my debugging code :(
Remove these lines:
Serial.print(now());
Serial.print("-");
Serial.print(Start);
Serial.print("-");
Serial.print(StartD);
Serial.print("-");
Serial.print(StopD);
Serial.print("-");
Serial.println(End);

To get the code to compile, open RAGen.
Go to features tab
Make sure you only have these checked:
Wifi
Watchdog Timer
Simple Menu
Version Menu
Display LED PWM
Click the save button
Now upload your code.
Roberto.
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

Sorry, I didn't see your last reply.
Meantime, I bought a proper router. I'll check again the wifi module in the next few days. Thanks
Image
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

I've fixed the wifi, I was able to connect the wifi module online, it takes ip, I fwd the port...but when i access either the internal IP:2000 or the external ip:2000 I get a blank page.

What am I doing wrong?

Thanks
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom code, please help

Post by rimai »

Does it work when you load the wifi test code?
File->Sketchbook->Example Codes->WifiTestCode
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Custom code, please help

Post by binder »

d0lph1n wrote:I've fixed the wifi, I was able to connect the wifi module online, it takes ip, I fwd the port...but when i access either the internal IP:2000 or the external ip:2000 I get a blank page.

What am I doing wrong?

Thanks
Does the page just say "Reef Angel Web Server"? If so, that's correct. To get your data, you need IP:2000/wifi
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

I reloaded the code and it works now.
The iPhone app displays the correct values, there external IP too.
But the web portal shows zero values (Check my signature)

What am I missing here?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom code, please help

Post by rimai »

Good.
You need to add the Portal() function to your code now.

Code: Select all

ReefAngel.Portal("d0lph1n");
Roberto.
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

Great. Thanks. It's working.
Image
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

is it possible to display the pwm values and labels on the local interface ip:2000/wifi?
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Custom code, please help

Post by binder »

d0lph1n wrote:is it possible to display the pwm values and labels on the local interface ip:2000/wifi?
No, it's not currently possible. It could be done but that page hasn't been updated for a while. Roberto would have to update it on the server to change it.
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

I didn't know it's running code from the reefangel site:
<script language='javascript' src='http://www.reefangel.com/wifi/ra1.js'></script>

K. I'll be waiting for Roberto to update it. Thanks
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom code, please help

Post by rimai »

It's in my list to do :)
I want to make it the same as the portal page
Roberto.
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

hey Roberto,

What's the default Actinic/Daylight PWM value outside the PWMSlop schedule or how can i set it the default value to zero. Thank you
Last edited by d0lph1n on Sat Jul 28, 2012 1:31 pm, edited 1 time in total.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom code, please help

Post by rimai »

The last parameter on the PWMSlope defines the returned value for outside the slope schedule.
Simply set it to 0.
Roberto.
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

Great. This is how it's setup right now. I just wanted to make sure. Thanks
Image
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

I'd like to control also the port 4 (off) in this if command, please advise:
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200) ReefAngel.Relay.On(Port6);

It doesn't work in this format:
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200) ReefAngel.Relay.On(Port6) ReefAngel.Relay.Off(Port4);

or

if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200) ReefAngel.Relay.On(Port6) && ReefAngel.Relay.Off(Port4);
Image
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

I think I got it:
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200){ReefAngel.Relay.On(Port6); ReefAngel.Relay.Off(Port4);}
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Custom code, please help

Post by binder »

d0lph1n wrote:I think I got it:
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200){ReefAngel.Relay.On(Port6); ReefAngel.Relay.Off(Port4);}
yes, this should work. you must use the brackets to group the statements to be executed.
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

I have too much par level on the blue channel at minimum Pwm value. Is it possible to lower it even more?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom code, please help

Post by rimai »

What do you mean?
I don't think you can go lower than 0% which means no light at all.
Are you talking about the driver cutoff point?
That's a limitation of whatever driver you are using.
I heard that Steve's LED can go down to 1% and the new meanwell LPF series can also go down to 3%.
Roberto.
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

Yeah, on 0% I still have too much light. I have no idea how to lower it.
What if I increase the number the LEDs?

Dave Fason, the guy I purchased the most of the LED parts but the drivers said the same thing that I have to change the driver since the Inventronics drivers don't go too low.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom code, please help

Post by rimai »

I'm afraid you will have to do that then.
Roberto.
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

One small issue:
Most of the web portal values are wrong: pH, temp, fan status etc. The iPhone app displays the correct values.

Also, where can I find more web portal banner options. I'd like a smaller banner pls. Thank you
Last edited by d0lph1n on Tue Aug 14, 2012 5:53 pm, edited 1 time in total.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom code, please help

Post by rimai »

The last time the controller sent data to the server was several hours ago.
Roberto.
d0lph1n
Posts: 122
Joined: Tue Dec 06, 2011 10:16 am

Re: Custom code, please help

Post by d0lph1n »

days ago...

I had some issues with the wifi module. How do I refresh that?
How do I put a small web portal banner?
Image
Post Reply