Page 2 of 2

Re: Trouble with setting multiple times for WP40 modes

Posted: Thu Jun 13, 2013 6:15 pm
by markywmson
Ok, thanks Lee

I haven't had time to get in and update these, hopefully Sunday night. Work and my 5 month old twins and wife are keeping me busy busy. As soon as I can try this (hopefully with a beer in hand) I will report back.

Thanks again!

-mark

Re: Trouble with setting multiple times for WP40 modes

Posted: Thu Jun 13, 2013 6:21 pm
by lnevo
Nice...keep us posted. I couldn't imagine dealing with twins...my one month old is enough work all on his own.

Re: Trouble with setting multiple times for WP40 modes

Posted: Fri Jun 14, 2013 6:43 pm
by markywmson
Still waiting to try this... but had another question as I was looking at graphs on the iPhone app (can't wait for the new one btw!)

If I see it correctly... TidalSwellMode ramps up to 45% from some other number. This works perfectly in the morning, but is there a way to inverse this, so it ramps down in the evening? Maybe I misunderstand this mode... (a distinct possibility)

Re: Trouble with setting multiple times for WP40 modes

Posted: Tue Jun 18, 2013 5:20 pm
by markywmson
Hey Lee (or anyone else)

With all that custom stuff that was written for my WP40, with the new libraries, is that all old and outdated? Will it still work? Or do I have to make big changes to it?

-mark

Re: Trouble with setting multiple times for WP40 modes

Posted: Tue Jun 18, 2013 5:40 pm
by lnevo
You could leave it as is for now, it should still work. I dont know yet exactly how the new libraries are working. My guess would be we would have to modify it and we will no longer have to run the set daylight and pick what function to use, we will use SetMode lime we can do with rf

Re: Trouble with setting multiple times for WP40 modes

Posted: Sat Jun 29, 2013 4:51 pm
by clw143
Is there a reason I can't do this:

Code: Select all

  if (hour()>=8 && hour()<12) wp40mode=6;
  else if (hour()>=12 && hour()<17) wp40mode=2;
  else if (hour()>=17 && hour()<18) wp40mode=5;
  else if (hour()>=18 && hour()<24) wp40mode=2;
  else wp40mode=4;


  if (wp40mode=6) ReefAngel.DCPump.SetMode( TidalSwell,80,10 ); // Tidal Swell at 80%
  if (wp40mode=5) ReefAngel.DCPump.SetMode( NutrientTransport,70,10 ); // Nutrient Transport at 70% with 10ms pulse
  if (wp40mode=4) ReefAngel.DCPump.SetMode( LongPulse,60,10 ); // Long pulse at 60% with 10s pulse
  if (wp40mode=3) ReefAngel.DCPump.SetMode( ShortPulse,50,10 ); //Short pulse at 50% with 10ms pulse
  if (wp40mode=2) ReefAngel.DCPump.SetMode( ReefCrest,40,10 ); // ReefCrest at 40%
  if (wp40mode=1) ReefAngel.DCPump.SetMode( Lagoon,30,10 ); // Lagoon at 30%
  if (wp40mode=0) ReefAngel.DCPump.SetMode( Constant,20,10 ); // Constant at 20%
Instead of this:

Code: Select all

if (hour()>=6 && hour()<11) {
  ReefAngel.PWM.SetDaylight( TidalSwellMode(45,true) ); // TidalSwell at 45% on sync mode
  ReefAngel.PWM.SetActinic( TidalSwellMode(45,true) ); // TidalSwell at 45% on sync mode
  wpMode=1;
} else if (hour()>=11 && hour()<15) {
  ReefAngel.PWM.SetDaylight( ReefCrestMode(70,20,true) ); // ReefCrest at 70% +/- 20% on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(70,20,false) ); // ReefCrest at 70% +/- 20% on anti-sync mode
  wpMode=2;
} else if ( (hour()>=15 && hour()<18) && (now()-feeding > SECS_PER_DAY) ) { // We haven't fed today
  ReefAngel.PWM.SetDaylight( NutrientTransportMode(30,60,6000,true) );
  ReefAngel.PWM.SetActinic( NutrientTransportMode(30,60,6000,false) );
  wpMode=3;
} else if (hour()>=15 && hour()<18) {
  ReefAngel.PWM.SetDaylight( ReefCrestMode(70,20,true) ); // ReefCrest at 70% +/- 20% on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(70,20,false) ); // ReefCrest at 70% +/- 20% on anti-sync mode
  wpMode=2;
} else if (hour()>=18 && hour()<20) {
  ReefAngel.PWM.SetDaylight( ReefCrestMode(70,20,true) ); // ReefCrest at 70% +/- 20% on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(70,20,false) ); // ReefCrest at 70% +/- 20% on anti-sync mode
  wpMode=2;
} else if (hour()>=20 && hour ()<23) {
  ReefAngel.PWM.SetDaylight( TidalSwellMode(45,true) ); // TidalSwell at 45% on sync mode
  ReefAngel.PWM.SetActinic( TidalSwellMode(45,true) ); // TidalSwell at 45% on sync mode
  wpMode=1;
} else {
  ReefAngel.PWM.SetDaylight(SineMode(15,40,30,true) ); //SineMode from 15% to 40% for 30 seconds on sync mode
  ReefAngel.PWM.SetActinic(SineMode(15,40,30,true) ); //SineMode from 15% to 40% for 30 seconds on sync mode
  wpMode=4;    
}    

Re: Trouble with setting multiple times for WP40 modes

Posted: Sat Jun 29, 2013 5:28 pm
by rimai
I think either way works.
The only thing I need to point out is that the code if (wp40mode=6) is not a comparison, it's a assignment statement.
You should use if (wp40mode==6)
http://arduino.cc/en/Reference/If
http://arduino.cc/en/Reference/Assignment

Re: Trouble with setting multiple times for WP40 modes

Posted: Sat Jun 29, 2013 7:12 pm
by lnevo
If your going to use DCPump.SetMode you also need to set UseMemory=false; and you may want an option to break out and use the options in the portal in which case you would need a case where you can do UseMemory=true;

ReefAngel.DCPump.UseMemory=false;

Re: Trouble with setting multiple times for WP40 modes

Posted: Sat Jun 29, 2013 7:53 pm
by clw143
rimai wrote:I think either way works.
The only thing I need to point out is that the code if (wp40mode=6) is not a comparison, it's a assignment statement.
You should use if (wp40mode==6)
http://arduino.cc/en/Reference/If
http://arduino.cc/en/Reference/Assignment
I'm confused, it seems to me this would be the assignment statement

Code: Select all

if (hour()>=8 && hour()<12) wp40mode==6;
and this is a comparison

Code: Select all

if (wp40mode=6) ReefAngel.DCPump.SetMode( TidalSwell,80,10 ); // Tidal Swell at 80%

Re: Trouble with setting multiple times for WP40 modes

Posted: Sat Jun 29, 2013 7:57 pm
by lnevo
== is comparison

= is assignment

Re: Trouble with setting multiple times for WP40 modes

Posted: Sat Jun 29, 2013 8:08 pm
by clw143
ohhh got it, thanks