Some issues with my code.

Do you have a question on how to do something.
Ask in here.
Post Reply
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Some issues with my code.

Post by Sacohen »

1st whenever "Else Mode" comes up in the random wave patterns the portal shows every option available.

Image

Image

Here is some of the testing that you Roberto and I did under Paul'd thread...

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.

Question from Lee to Roberto...
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...
Roberto's Response
Yeah... I think so.
Lee's response...
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?
Also is Lee was going to work on a way to set different speeds for different pumps.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Some issues with my code.

Post by lnevo »

You shouldnt be using Else to set DCpump. Its invalid. DCPump.Mode should be getting set to custom.

I'll look at your code again to see whats up.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Some issues with my code.

Post by lnevo »

For different speeds i think roberto and alan may have addressed it someway...need roberto to chime in.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Some issues with my code.

Post by Sacohen »

I'm just using the code you gave me.

You know I don't know enough about coding to set that up.

Sent from my HTC One VX using Tapatalk
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Some issues with my code.

Post by lnevo »

I know... just need to see what we're doing. You have the random bit, so i may have made an assumption that i shouldnt have. But look how far you've come. You identified exactly the issue after going through all the troubleshooting :)
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Some issues with my code.

Post by Sacohen »

That was all TS that you and Roberto did with me, but thank you.

Sent from my HTC One VX using Tapatalk
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Some issues with my code.

Post by Sacohen »

I started testing this again and removed everything from the available choices except Else Mode.
When the RA rebooted the Portal is not showing me everything like it was before.

It is now showing the Portal as it should, but the DC Pump Mode is listed as whatever it was before I removed all the other options and rebooted.

For Example Before the Reboot the Portal displayed that it was in Reef Crest mode and after I rebooted the Portal still says it's in Reef Crest mode even though that was not one of the options that it could choose from.

I'm sure that it is displaying the last mode it was in because there is not Else in the Libraries for it to display.

This is acceptable. I just hated every option available to the RA showing up on screen.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Some issues with my code.

Post by Sacohen »

OK. I spoke to soon.
I put all on my choices back in my code and uploaded it to the unit and when I refreshed the Portal it was showing me every option available again and was displaying "Reef Crest" ass the mode type under DC Pumps.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Some issues with my code.

Post by lnevo »

Code: Select all

    ReefAngel.DCPump.Mode=modes[rmode];  // Put the mode to the random mode :)
This is the line that is causing it because we are setting the mode ReefAngel.DCPump.Mode to the random mode which includes Else. I'll have a better method shortly. Just wanted to post this :)
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Some issues with my code.

Post by lnevo »

Actually, we were doing that already... and it should be getting set to Constant.. hmm

Code: Select all

  if (rmode==Else) {
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.Mode=Constant;
    ReefAngel.DCPump.Speed=ElseMode(InternalMemory.DCPumpSpeed_read(),20,true );    // ElseMode on sync mode, Portal Speed Setting +/- 20%
  } else {
    ReefAngel.DCPump.Mode=modes[rmode];  // Put the mode to the random mode :)
    ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
  }
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Some issues with my code.

Post by Sacohen »

I'll keep an eye out for something.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Some issues with my code.

Post by lnevo »

Ahh I know what the issue is!! rmode is our random number in the array... not the actual mode.

Try this:

Code: Select all

if (modes[rmode]==Else) {
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Some issues with my code.

Post by Sacohen »

OK. I'll try it tonight or tomorrow.
I can't seem to log into my laptop remotely right now to make the change.
lnevo wrote:Change this line

Code: Select all

  if (rmode==Else) {
to

Code: Select all

  if (modes[rmode]==Else) {
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Some issues with my code.

Post by Sacohen »

You're the man.
That seemed to do it.
It shows a Pump Mode of constant, but the speed is not I't changing (as it should be).

Thanks Lee.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Some issues with my code.

Post by lnevo »

but the speed is not I't changing (as it should be).
Speed should be changing as every iteration of loop we are setting the speed to ElseMode(InternalMemory.DCPumpSpeed_read(),20,true)

There are a few issues though, one is that we would not get any sync/anti-sync functionality there. I think we should revert to using the PWM commands here. Let's try this:

Code: Select all

  if (rmode==Else) {
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.Mode=Constant;
    ReefAngel.DCPump.Speed=ElseMode(InternalMemory.DCPumpSpeed_read(),20,true );    // ElseMode on sync mode, Portal Speed Setting +/- 20%
  } else {

Code: Select all

  if (rmode==Else) {
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.PWM.SetDaylight(ElseMode(InternalMemory.DCPumpSpeed_read(),20,true) );    // ElseMode on sync mode, Portal Speed Setting +/- 20%
    ReefAngel.PWM.SetActinic(ElseMode(InternalMemory.DCPumpSpeed_read(),20,false) );    // ElseMode on anti-sync mode, Portal Speed Setting +/- 20%
  } else {
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Some issues with my code.

Post by Sacohen »

I'll do it tonight.

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

Re: Some issues with my code.

Post by Sacohen »

Thanks Lee.
I'm going to put this issue to the side for now until I iron out some hardware issues that Roberto and I have been trying to figure out,

I don't want to introduce anything new into the mix right now.
Post Reply