Page 1 of 1
DC PUMP Custom on portal not working
Posted: Tue Aug 06, 2013 9:23 am
by Smotz
Hey all -
I have a custom routine going for my WP-40. I recently noticed that I cannot use the portal to set the pump config.
Can someone look at the code and tell me where I am wrong? - Notice the if/else code..
Code: Select all
if (ReefAngel.DCPump.Mode==Custom) {
ReefAngel.DCPump.UseMemory = false;
// set the wpMode
if ( (hour() >= 5) && (hour() < 8) ) wpMode=1; // from 5am - 8am
if ( (hour() >= 8) && (hour() < 11) ) wpMode=2; // from 8am - 11am
if ( (hour() >= 11) && (hour() < 14) ) wpMode=3; // from 11a - 2pm
if ( (hour() >= 14) && (hour() < 17) ) wpMode=2; // from 2pm - 5pm
if ( (hour() >= 17) && (hour() < 20) ) wpMode=1; // from 5pm - 8pm
if ( (hour() >= 20) && (hour() < 23) ) wpMode=2; // from 8pm - 11p
if ( (hour() >= 23) && (hour() < 2) ) wpMode=3; // from 11pm - 2am
if ( (hour() >= 2) && (hour() < 5) ) wpMode=2; // from 2am - 5am
if (wpMode==1) wpWavStr=50;
if (wpMode==2) wpWavStr=55;
if (wpMode==3) wpWavStr=60;
//Set the Wave OffSet
wpWavOff=10;
ReefAngel.PWM.SetDaylight( ReefCrestMode(wpWavStr,wpWavOff,true) );
ReefAngel.PWM.SetActinic(wpWavStr);
}
else ReefAngel.DCPump.UseMemory = true;
// end Custom Wave Routine
Re: DC PUMP Custom on portal not working
Posted: Tue Aug 06, 2013 9:46 am
by lnevo
The 11pm to 2am will not work, that test needs to be an || not an &&
What about the code aside from that is not working....
You should add some Serial,println in for debugging and view through Serial Monitor...
Re: DC PUMP Custom on portal not working
Posted: Tue Aug 06, 2013 9:48 am
by Smotz
huh?
why the 11pm to 2am as opposed to any other time? and if i set it to 'or' wouldn't it be true for many times?
When I select a mode from the portal it doesn't work - it stays on my custom routine.
Re: DC PUMP Custom on portal not working
Posted: Tue Aug 06, 2013 9:53 am
by lnevo
I would also change the initial if from if DCPumpMode==Custom to... InternalMemory.DCPumpMode_read()==Custom
Re: DC PUMP Custom on portal not working
Posted: Tue Aug 06, 2013 9:57 am
by lnevo
Yes it will mess up your other ifs the way you have it structured...
You could break it into two ifs to make it easier.
The reason that one doesn't work is because you cant have a number that is greater than 23 AND less than 2...unless you know of some numbers that I don't
I would make it two ifs one that is < 2 only and one that is > 23.
It might work with an or, Id have to read it more closely.
The problem with your if is that once you've shifted to UseMemory=false then it won't ever switch out of your condition...that's why I mentioned in my last post to change to the memory read function.
That should fix your issue,
Re: DC PUMP Custom on portal not working
Posted: Tue Aug 06, 2013 10:01 am
by Smotz
Perfect Lee - Thanks.
Not sure if I am going to fix the time thing. You've confused me too much and I don't think it's that important.
Re: DC PUMP Custom on portal not working
Posted: Tue Aug 06, 2013 10:09 am
by lnevo
Just do this:
Code: Select all
if (hour() >= 23) wpMode=3; // from 11pm - midnight
if (hour() < 2) wpMode=3; // from midnight - 2am
Re: DC PUMP Custom on portal not working
Posted: Tue Aug 06, 2013 10:10 am
by lnevo
And re-reading the code I think changing && to || would be fine
Re: DC PUMP Custom on portal not working
Posted: Tue Aug 06, 2013 10:11 am
by Smotz
lnevo wrote:Just do this:
Code: Select all
if (hour() >= 23) wpMode=3; // from 11pm - midnight
if (hour() < 2) wpMode=3; // from midnight - 2am
Will do. I see now. Thank you again - you rock, as always.

Re: DC PUMP Custom on portal not working
Posted: Tue Aug 06, 2013 10:12 am
by Smotz
lnevo wrote:And re-reading the code I think changing && to || would be fine
agreed.
Re: DC PUMP Custom on portal not working
Posted: Wed Aug 07, 2013 5:44 am
by Smotz
lnevo wrote:I would also change the initial if from if DCPumpMode==Custom to... InternalMemory.DCPumpMode_read()==Custom
Lee - this didn't work for me.
When I set it, the speeds no longer registered on my Android app, and I was still unable to change the mode on the portal.
When I try to change the mode on the portal and click save, the setting does not change.
Re: DC PUMP Custom on portal not working
Posted: Wed Aug 07, 2013 12:11 pm
by Piper
Smotz wrote:lnevo wrote:I would also change the initial if from if DCPumpMode==Custom to... InternalMemory.DCPumpMode_read()==Custom
Lee - this didn't work for me.
When I set it, the speeds no longer registered on my Android app, and I was still unable to change the mode on the portal.
When I try to change the mode on the portal and click save, the setting does not change.
I was playing around with this a couple of nights ago myself. I used
InternalMemory.DCPumpMode_read() to get the mode that was set in the portal and assigned it to a custom variable so I can see what that actual value is for the mode. I found that it took a few seconds to a minute or two for the portal to show correctly but it eventually worked. Didn't check the Android App though.
When you say it doesn't register the speed, it shows 0 for Daylight and Actinic PWM ports in the Android App? Are the pumps actually working when that happens?
~Charlie
Re: DC PUMP Custom on portal not working
Posted: Wed Aug 07, 2013 1:13 pm
by lnevo
That does not make sense that changing the memory location did not reflect on the portal...
Unless as Charlie suggested that you did not wait long enough. You could check the wifi directly for the memory setting to see if it's updating...
http://reefangelwifi:2000/mb337
Re: DC PUMP Custom on portal not working
Posted: Wed Aug 07, 2013 2:23 pm
by Piper
He's saying that it was not showing on the Android app though. I just went on a tangent about the Portal

I was trying to clarify what, exactly, that meant. i.e. was it not showing on the Daylight and Actinic ports or somewhere else. The Android app should pick that up right away I would think.
Re: DC PUMP Custom on portal not working
Posted: Wed Aug 07, 2013 8:32 pm
by Smotz
i'll test tomorrow am for clarification