DC PUMP Custom on portal not working

Do you have a question on how to do something.
Ask in here.
Post Reply
Smotz
Posts: 412
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

DC PUMP Custom on portal not working

Post 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
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: DC PUMP Custom on portal not working

Post 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...
Smotz
Posts: 412
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: DC PUMP Custom on portal not working

Post 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.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: DC PUMP Custom on portal not working

Post by lnevo »

I would also change the initial if from if DCPumpMode==Custom to... InternalMemory.DCPumpMode_read()==Custom
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: DC PUMP Custom on portal not working

Post 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,
Smotz
Posts: 412
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: DC PUMP Custom on portal not working

Post 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.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: DC PUMP Custom on portal not working

Post by lnevo »

Just do this:

Code: Select all

    if (hour() >= 23) wpMode=3;      // from 11pm - midnight 
    if (hour() < 2) wpMode=3;      // from midnight - 2am
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: DC PUMP Custom on portal not working

Post by lnevo »

And re-reading the code I think changing && to || would be fine
Smotz
Posts: 412
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: DC PUMP Custom on portal not working

Post 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. ;)
Smotz
Posts: 412
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: DC PUMP Custom on portal not working

Post by Smotz »

lnevo wrote:And re-reading the code I think changing && to || would be fine
agreed.
Smotz
Posts: 412
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: DC PUMP Custom on portal not working

Post 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.
Piper
Posts: 296
Joined: Fri Jul 20, 2012 7:13 am
Location: Oakley, CA

Re: DC PUMP Custom on portal not working

Post 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
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: DC PUMP Custom on portal not working

Post 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
Piper
Posts: 296
Joined: Fri Jul 20, 2012 7:13 am
Location: Oakley, CA

Re: DC PUMP Custom on portal not working

Post 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.
Smotz
Posts: 412
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: DC PUMP Custom on portal not working

Post by Smotz »

i'll test tomorrow am for clarification
Post Reply