PaulTurner911 Code

Share you PDE file with our community
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: PaulTurner911 Code

Post by Sacohen »

It is seconds. I guess I was missing the switch before.
I just timed it.

All looks to be good.
You did it again man.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: PaulTurner911 Code

Post by Sacohen »

Lee;

The Random mode has been working great.
I think it went to the Else Mode today and the reason I say that is about a week ago I norticed it had never done the Else mode, so I made that the only choice in the modes to choose from.

When the unit re-started I looked at the portal to see what mode it said it was in and it read 30%, with no mode listed, but I had every option showing on the portal again like I did before.

Image

Image

Any ideas?

I could live with this if need be.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: PaulTurner911 Code

Post by lnevo »

Change the mode to something else. Then save. Then put back to custom.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: PaulTurner911 Code

Post by Sacohen »

I did try that last night from my phone while I was at my sons baseball game. When I set it back to custom the portal interface did not change. It only changed at 9pm when it went into the 30% constant night flow, which it is still in now. I'll see what happens at noon when it picks the next random mode.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: PaulTurner911 Code

Post by lnevo »

I think it's similar to the issue we had before where the DCPump settings don't get set because we see memory is set for custom mode so we are always in UseMemory=false;

What would be helpful would be to reboot the controller later and see what DCS, DCM, and DCD are set to from the /r99 output. If any are 255 then yeah its the same issue and I can look at at better method then what we did last time...
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: PaulTurner911 Code

Post by Sacohen »

I've set the code to only have the Else mode as an option and them I checked the r99 out up and there is no 255 in the DCS, DCM and DCD.

They are actually set to the setting I have in portal.

<DCM>16</DCM>
<DCS>50</DCS>
<DCD>30</DCD>

The 16 for DCM is what the Else mode is defined as in the code...

// Add Else Mode definition..
const int Else=16;

In addition I added the ReefAngel.DCPump.UseMemory=false; to the code and the Portal is still messed up.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: PaulTurner911 Code

Post by lnevo »

And your still getting issues in the portal? I meant set it back to custom then reboot ra then check r99..
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: PaulTurner911 Code

Post by Sacohen »

Yes. If I remove all the choices from the available modes list except for Else, have it in custom on the portal and upload the code it will reboot in Else mode and the portal will be wacked.

If I check the r99 output it will show...
<DCM>16</DCM>
<DCS>50</DCS>
<DCD>30</DCD>

When I add all the choices back in it will re-boot with what ever (this time it was ReefCrest) and the portal will be correct.

I don't want to hi-jack this thread with this, should I start another thread?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: PaulTurner911 Code

Post by rimai »

There is no such mode 16
Roberto.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: PaulTurner911 Code

Post by Sacohen »

It was defined in the code..

// Add Else Mode definition..
const int Else=16;

I'm not sure if Lee defined that or it was in Collin's original code.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: PaulTurner911 Code

Post by rimai »

Ahh. Sorry
Roberto.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: PaulTurner911 Code

Post by Sacohen »

No problem
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: PaulTurner911 Code

Post by lnevo »

Roberto could that be screwing with the portal though?

The mode should show 11 since its part of our custom mode.

This could be part of the issue...
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: PaulTurner911 Code

Post by rimai »

Yeah... I think so.
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: PaulTurner911 Code

Post by lnevo »

Do you think it would be better to fix it on the backend? I mean if someone didn't initialize memory they would have the 255 issue we saw earlier? Either way I can fix in the INO. Steve, can you update your thread with latest version if its not already?
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: PaulTurner911 Code

Post by Sacohen »

It is updated with the current version.
Paulturner911
Posts: 288
Joined: Wed Jan 23, 2013 12:36 pm

Re: PaulTurner911 Code

Post by Paulturner911 »

Is there anyway to test the WP pump (I trashed the controller day 1), mines not running. Gotta be a way....

It would happen ever once and a while with my current code on random, but I could power cycle and all was well. No longer the case, she unresponsive. I went to the portal and changed the mode, it reflects on the controllers screen. Ive checked all connections, the ac/dc trans for the WP, the power to Jebo adapter, adapter to the PWM, and adapter to the WP...TWICE.
But the pump isnt working.

Anyhelp in trouble shooting would be great. Thanks
Image
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

Re: PaulTurner911 Code

Post by sabo »

Tried cleaning the pump?
Paulturner911
Posts: 288
Joined: Wed Jan 23, 2013 12:36 pm

Re: PaulTurner911 Code

Post by Paulturner911 »

Yeah, I tore into it pretty good. Also, tried it with the factory controller someone let me use.
Image
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: PaulTurner911 Code

Post by Sacohen »

Paul;

PM me your address. I'll send you a spare I have if you promise to send it back.
You don't need the PS do you? I don't have a spare for that.

That brings up a question, you're sure you're getting power out of the PS.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: PaulTurner911 Code

Post by lnevo »

Just adding a link to Paul's most recent code, since there's about 15 pages of me and Steve troubleshooting his... lol

http://forum.reefangel.com/viewtopic.php?p=32040#p32040
Paulturner911
Posts: 288
Joined: Wed Jan 23, 2013 12:36 pm

Re: PaulTurner911 Code

Post by Paulturner911 »

lnevo wrote:Just adding a link to Paul's most recent code, since there's about 15 pages of me and Steve troubleshooting his... lol

http://forum.reefangel.com/viewtopic.php?p=32040#p32040
You SIR are a gentleman and a scholar!!! :)
Just paypal'd Roberto some money for a second jeabo adapter, pumps and harness should arrive soon, patience is a virtue.

Lee, Id like to be in the same boat as Scohen running them antisync and retaining current functionality.

Sorry to beat a dead horse, but could you please run down the duration and speed setup again?!? I think I remember duration in the portal does nothing, but speed has a variance that is defined somewhere hardcoded to make the pump run from 25%-75%. Just dont remember where to define this value and what it should be.

Thank you!!
Image
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: PaulTurner911 Code

Post by Sacohen »

Maybe Lee can add more to it, or explain it better, but this is what I have in my code of the speed variable.

Code: Select all

ReefAngel.DCPump.Speed=ElseMode(InternalMemory.DCPumpSpeed_read(),20,true );    // ElseMode on sync mode, Portal Speed Setting +/- 20%
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: PaulTurner911 Code

Post by lnevo »

Speed is Speed and Duration is Duration. You have nothing in your code that will make anything change versus what's set in the portal. No Variance that I can find. You only had one pump... so would not even mean anything to you initially...

I sent you how to activate the second pump in the anti-sync mode... You just need to define the channel and what it is going to be Sync/Anti-Sync.

Lee
Paulturner911
Posts: 288
Joined: Wed Jan 23, 2013 12:36 pm

Re: PaulTurner911 Code

Post by Paulturner911 »

Got it.
You make it sound so simple.
And make me feel like an ass for asking.
There is something that we used to limit the pumps range of power, effectivly stopping the pump from running full power. For whatever reason I thought it had to do with speed and duration.
Image
Paulturner911
Posts: 288
Joined: Wed Jan 23, 2013 12:36 pm

Re: PaulTurner911 Code

Post by Paulturner911 »

lnevo wrote:Speed is Speed and Duration is Duration. You have nothing in your code that will make anything change versus what's set in the portal. No Variance that I can find. You only had one pump... so would not even mean anything to you initially...

I sent you how to activate the second pump in the anti-sync mode... You just need to define the channel and what it is going to be Sync/Anti-Sync.

Lee
// Change this to what you want your min/max based on vortech speed
// This is for those functions that take both, but only one memory slot.
int minOffset=25;
int maxOffset=25;

This is what I was thinking....isnt this where you would define the range of the pump (in relation to portal speed)?
PORTAL SPEED=60(currently) +/-25
Pump should run 35-85?
I must not have the correct understanding (not uncommon)
Trying to refresh my noodle.
Last edited by Paulturner911 on Mon Jun 23, 2014 1:48 pm, edited 1 time in total.
Image
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: PaulTurner911 Code

Post by Sacohen »

lnevo wrote:Just adding a link to Paul's most recent code, since there's about 15 pages of me and Steve troubleshooting his... lol

http://forum.reefangel.com/viewtopic.php?p=32040#p32040
We never did fix the problem.
I think you said you were going to fix it on the back end.
I can start a new thread for that issue if you want.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: PaulTurner911 Code

Post by lnevo »

Lol what was the issue that you couldnt set the % on the 2nd pump differently?
Paulturner911
Posts: 288
Joined: Wed Jan 23, 2013 12:36 pm

Re: PaulTurner911 Code

Post by Paulturner911 »

Badass! Got everything working, just need the pump!

I also added my skimmer to the feed mode and water change so it power cycles instead of running when its not needed. Added Long Pulse to the random...atleast it didnt give me an error, so I think I did :)

Thanks for the help!
I hadnt touched this stuff in ages, had to do the drivers and software install again since I replaced the HD on my PC. Kinda started to sweat for a min, but it all worked out :)

Code: Select all

// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port7Bit | Port8Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port3Bit | Port6Bit | Port7Bit | Port8Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;

// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;


// Ports that are always on

////// Place additional initialization code below here


////// Place additional initialization code above here
}

void loop()
{
ReefAngel.DayLights( Port1 ); // Return Pump
ReefAngel.StandardFan( Port2 ); // Canopy Fans
ReefAngel.ActinicLights( Port3 ); // Actinic LEDS
//Port4 Kalk/ATO
//Port5 Kalk Stir
ReefAngel.DayLights( Port6 );//Port 6 Skimmer
ReefAngel.DayLights( Port7 ); // MH 1
ReefAngel.DayLights( Port8 ); //MH 2
//Moonlight Phase 9pm-10am (CH4-CH5)
if ( (hour() >=10) && (hour() <21) ) 
ReefAngel.PWM.SetChannel( 4,(0) );
else 
ReefAngel.PWM.SetChannel( 4, MoonPhase() );
if ( (hour() >=10) && (hour() <21) ) 
ReefAngel.PWM.SetChannel( 5,(0) );
else
ReefAngel.PWM.SetChannel( 5, MoonPhase() );

//Over Flow Protection
if (ReefAngel.HighATO.IsActive())
ReefAngel.Relay.On(Port1);
else
ReefAngel.Relay.Off(Port1);

//ATO Protection
if (ReefAngel.LowATO.IsActive())
ReefAngel.Relay.On(Port4);
else
ReefAngel.Relay.Off(Port4);

//Kalk Dose 60sec @ 11pm-12pm (every 15min)
if (hour() >=23 || hour() < 12)
ReefAngel.Relay.Set(Port4, now()%900<60);
else
ReefAngel.Relay.Off(Port4);

//Kalk Stir 12pm-1pm
if (hour() >=12 & hour() < 13)
ReefAngel.Relay.On(Port5);
else
ReefAngel.Relay.Off(Port5);

ReefAngel.DCPump.UseMemory = true;
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
////// Place your custom code below here

///// Place your custom code below here

// Add random mode if we set to Mode to Custom in portal
static int rmode;
static boolean changeMode=true;

// These are the modes we can cycle through. You can add more and even repeat...
byte modes[] = { ReefCrest, TidalSwell, ShortPulse, LongPulse, NutrientTransport };

if (now()%SECS_PER_DAY==0 || changeMode==true) { // Change at midnight or if controller rebooted
rmode=random(100)%sizeof(modes); // Change the mode once per day to pick from our array
changeMode=false;
}

// Set timer when in feeding mode
static unsigned long feeding;
if (ReefAngel.DisplayedMenu==FEEDING_MODE) feeding=now();

if (now()-feeding<900) { 
  // First 15 minutes after feeding mode stops. Return Pump is off
  ReefAngel.Relay.Off(Port1);
  // First 15 minutes after feeding mode stops. Smart_NTM
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Mode=NutrientTransport;
} else if (now()-feeding<4500) { // 15 minutes plus 1 hour
  // Continue NTM for the next 60 minutes (75 minutes total)
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Mode=NutrientTransport;
} else if (now()%SECS_PER_DAY<30600 || now()%SECS_PER_DAY>=81000) { // 8:30am / 10:30pm
  // Night mode (go to 30%)
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Mode=Constant;
  ReefAngel.DCPump.Speed=30;
} else if (InternalMemory.DCPumpMode_read()==11) { 
  // Custom Mode and nothing else going on
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Mode=modes[rmode];  // Put the mode to the random mode :)
  ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
} else {
  ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
Image
Paulturner911
Posts: 288
Joined: Wed Jan 23, 2013 12:36 pm

Re: PaulTurner911 Code

Post by Paulturner911 »

Right back at it of course...

Added else mode after hacking around with SaCohens code.
Image
Post Reply