Why my wave str is -1 when assigned?

Basic / Standard Reef Angel hardware
Post Reply
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Why my wave str is -1 when assigned?

Post by Smotz »

'lo all..

Something stupid - not a huge deal.
Can anyone advise why my wave strength is 1 less than assigned during feeding mode? In the code below I assigned it to 28% yet when in feeding mode it is at 27%

Code: Select all

// Custom Wave Routine 
// set the wpMode based on what time it is
    if ( (hour() >= 2) && (hour() < 5) ) wpMode=1;       // from 2am - 5am  
    if ( (hour() >= 5) && (hour() < 8) )  wpMode=2;     // from 5am - 8am
    if ( (hour() >= 8) && (hour() < 11) ) wpMode=4;      // from 8am - 11am  Nutrient Transport
    if ( (hour() >= 11) && (hour() < 14) ) wpMode=2;     // from 11a - 2pm
    if ( (hour() >= 14) && (hour() < 17) ) wpMode=1;     // from 2pm - 5pm
    if ( (hour() >= 17) && (hour() < 20) ) wpMode=2;     // from 5pm - 8pm
    if ( (hour() >= 20) && (hour() < 23) ) wpMode=3;     // from 8pm - 11p
    if (hour() >= 23) wpMode=2;                          // from 11pm - midnight 
    if (hour() < 2) wpMode=1;                            // from midnight - 2am
    if (ReefAngel.DisplayedMenu==FEEDING_MODE) wpMode=5;  // Feeding Mode
    if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE) wpMode=6; //Water Change Mode
      
    switch (wpMode) 
    {
    case 1:  wpWavStr=29; wpWavOff=3; break;
    case 2:  wpWavStr=31; wpWavOff=5; break;
    case 3:  wpWavStr=33; wpWavOff=7; break;
    case 4:  wpWavStr=40; wpWavOff=50; break;
    [b]case 5:  wpWavStr=28; wpWavOff=0; break;  // Feeding mode[/b]
    case 6:  wpWavStr=0; wpWavOff=0; break;   // Waterchange Mode
    default: wpWavStr=34; wpWavOff=2;
    }
//If 8am - 11am, Nutrient Transport   
    if (wpMode==4)
    {
    ReefAngel.PWM.SetDaylight( NutrientTransportMode(wpWavStr,wpWavOff,7000,true) );
    ReefAngel.PWM.SetActinic ( NutrientTransportMode(wpWavStr,wpWavOff,7000,false) );
    }
    else  
    {
  [b]  if (wpMode==5)
    {    
    ReefAngel.PWM.SetDaylight(wpWavStr);
    ReefAngel.PWM.SetActinic(wpWavStr);    //// Right wavemaker under feeder
    }[/b]
    else
    {
//Set the wave     
    ReefAngel.PWM.SetDaylight( ElseMode(wpWavStr,wpWavOff,true) );
    ReefAngel.PWM.SetActinic( ElseMode(wpWavStr,wpWavOff,false) );
    }}
//end Custom Wave Routine   
Last edited by Smotz on Thu Oct 23, 2014 5:17 am, edited 1 time in total.
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: Why my wave str is -1 when assigned?

Post by Smotz »

Nothin huh
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Why my wave str is -1 when assigned?

Post by lnevo »

It might be something with the rounding in the 12bit conversion.
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: Why my wave str is -1 when assigned?

Post by Smotz »

thats what I was thinking :-)
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Why my wave str is -1 when assigned?

Post by lnevo »

Where are you seeing the 27? On the screen? Or in the portal?
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: Why my wave str is -1 when assigned?

Post by Smotz »

On the android app
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Why my wave str is -1 when assigned?

Post by lnevo »

Hmm, I took a look at the math and it even adds .5 to address any rounding issues. Maybe Alan can take a look with that number to see if it's reproducible.

Are you sure there's no other code affecting it.
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: Why my wave str is -1 when assigned?

Post by Smotz »

Not, I am not positive - Nothing else calls for that variable. It's not crucial, either - don't want to take people away from more important stuff. I was just curious. I can simply make adjustments knowing the discrepancy.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Why my wave str is -1 when assigned?

Post by lnevo »

Nonsense, this is the fun stuff.
Post Reply