Some questions on some code of storm and delay

Basic / Standard Reef Angel hardware
Post Reply
troylong45
Posts: 214
Joined: Sat Oct 10, 2015 9:17 pm

Some questions on some code of storm and delay

Post by troylong45 »

this code i got from lee for my dc pumps to run dcpumps for 5mins after feed then after 5mins starts delay relay and not sure what the code is all saying i dont belive i need the high float part? Its for return pump

Code: Select all

void DelayedOnFeedMode(byte relay) {
  static unsigned long startTime=now();

  if ( (startTime==LastStart || ReefAngel.DisplayedMenu==WATERCHANGE_MODE) && ReefAngel.HighATO.IsActive()) {
    ReefAngel.Relay.On(relay);
  } else {
    ReefAngel.Relay.DelayedOn(relay);
  }
}
and if i switch from feed to wc and/or back to exit mode the delayed relay stays in effect i would like it if i hit exit mode to clear the delay relay

and in the storm cloud code the 0 in DaylightPWMValue2,0,180 is that the minimum % it flashes or dims to? Im havving issue with it changing led % to low i want to limit how low dims for flashes and clouds its making mg update led code turn the relays for the leds off

Code: Select all

 //is it time for cloud yet?
    if (NumMins(hour(),minute())>=cloudstart && NumMins(hour(),minute())<(cloudstart+cloudduration))
    {
      // Increase Blue channel first for better effect and to compensate for drop in Whites
      ActinicPWMValue1=ReversePWMSlopeHighRes(cloudstart,cloudstart+cloudduration,ActinicPWMValue1,ActinicPWMValue1+DaylightPWMValue0,180);
      ActinicPWMValue3=ReversePWMSlopeHighRes(cloudstart,cloudstart+cloudduration,ActinicPWMValue3,ActinicPWMValue3+DaylightPWMValue2,180);
     
      DaylightPWMValue0=ReversePWMSlopeHighRes(cloudstart,cloudstart+cloudduration,DaylightPWMValue0,0,180);
      DaylightPWMValue2=ReversePWMSlopeHighRes(cloudstart,cloudstart+cloudduration,DaylightPWMValue2,0,180);
      if (chooseLightning)
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Some questions on some code of storm and delay

Post by rimai »

Just remove the ATO part and use only the on instead of delayedon.
Yeah, I believe the 0 is for lowest dim.
Just change it and see what happens.
Roberto.
troylong45
Posts: 214
Joined: Sat Oct 10, 2015 9:17 pm

Re: Some questions on some code of storm and delay

Post by troylong45 »

ok i did this to the feedmode exit code

Code: Select all

void loop()
        {
        DelayedOnFeedMode(Return); // DelayedOn after feed mode change only

Code: Select all

void DelayedOnFeedMode(byte relay) {
  static unsigned long startTime=now();

  if ( (startTime==LastStart || ReefAngel.DisplayedMenu==FEEDING_MODE)) {  //edit cahnged ""WATERCHANGE_MODE) && ReefAngel.HighATO.IsActive()) {'' to FEEDING_MODE)) {
    ReefAngel.Relay.On(relay);
  } else {
    ReefAngel.Relay.On(relay);  //edit deleted "delayed" from ReefAngel.Relay.DelayedOn(relay);
  }
}
no change from what i can tell when hitting exit mode on uapp it still stays in return pump delay for the 5 mins, and same if it cycle to waterchange mode and exit mode
Image
troylong45
Posts: 214
Joined: Sat Oct 10, 2015 9:17 pm

Re: Some questions on some code of storm and delay

Post by troylong45 »

and i changed those 0 to 2 to keep it above the updateled off relay level like this but it still do it at the end of flash i belive

Code: Select all

      DaylightPWMValue0=ReversePWMSlopeHighRes(cloudstart,cloudstart+cloudduration,DaylightPWMValue0,2,180); //edit to stop channel from going off on storm and cloud ,0,180>,2,180
      DaylightPWMValue2=ReversePWMSlopeHighRes(cloudstart,cloudstart+cloudduration,DaylightPWMValue2,2,180); //edit to stop channel from going off on storm and cloud ,0,180>,2,180
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Some questions on some code of storm and delay

Post by rimai »

If you don't want the delay, why are you even using that function?
You will have to debug it and see what is happening on your code.
Add some serial prints and watch what happens on serial monitor.
Like this:

Code: Select all

Serial.println("Something happened here");
Roberto.
troylong45
Posts: 214
Joined: Sat Oct 10, 2015 9:17 pm

Re: Some questions on some code of storm and delay

Post by troylong45 »

what i want to happen is ill put it in feed mode to feed fish and coral, then would like for feed to count down and have the dcpumps to kick in to smartntm(runs nutiriant mode for 5mins) mode i think it was called 5mins befor the return come on

so really what im trying to make happen is the smartntm to be on 5mins befor feedmode ends
Image
troylong45
Posts: 214
Joined: Sat Oct 10, 2015 9:17 pm

Re: Some questions on some code of storm and delay

Post by troylong45 »

Changing the numbers i posted about the storm code seems to not do nothing, i changed 0 to 2 anf still goes off it seems its only in the cloud part i turned flash to 0% chance.

Anyone know who created the cloud code maybe they know if theres is a min dim
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Some questions on some code of storm and delay

Post by lnevo »

It's high res so make it 100 otherwise its still less than 1%
troylong45
Posts: 214
Joined: Sat Oct 10, 2015 9:17 pm

Re: Some questions on some code of storm and delay

Post by troylong45 »

Ok ill try that so try swaping the 0 with maybe 200 instead of 1 or 2
Image
troylong45
Posts: 214
Joined: Sat Oct 10, 2015 9:17 pm

Re: Some questions on some code of storm and delay

Post by troylong45 »

They still went off i think it did. Ill find out when im off Saturday
Image
Post Reply