Page 3 of 5
Re: Dosing Pump not running on Schedule
Posted: Thu Jun 13, 2013 10:34 am
by lnevo
Sorry. add a ; to the end of both portalMinutes and portalSeconds
Re: Dosing Pump not running on Schedule
Posted: Thu Jun 13, 2013 12:06 pm
by kirkwood
Now the error message is from this part of code and it highlights the '{' symbol
byte portalMinutes; = { 0, 2, 4 }
expected primary-expression before "=" token
Re: Dosing Pump not running on Schedule
Posted: Thu Jun 13, 2013 12:28 pm
by lnevo
I meant end of the line...
Re: Dosing Pump not running on Schedule
Posted: Thu Jun 13, 2013 12:58 pm
by kirkwood
lnevo wrote:I meant end of the line...
byte portalMinutes = { 0, 2, 4 };
I made the change to the code above but this produced the same error as before -
scalar object 'portalMinutes' requires one element in initializer
Here is what is said when I verified the code before compiling and uploading.
The following features were detected:
Wifi Attachment
Custom Variable
Simple Menu
sketch_jun13_ATOadded.cpp: In function 'void loop()':
sketch_jun13_ATOadded:81: error: scalar object 'portalMinutes' requires one element in initializer
sketch_jun13_ATOadded:82: error: scalar object 'portalSeconds' requires one element in initializer
sketch_jun13_ATOadded:110: error: 'Port7bit' was not declared in this scope
sketch_jun13_ATOadded:113: error: 'Port7bit' was not declared in this scope
sketch_jun13_ATOadded:113: error: expected `)' before '{' token
Re: Dosing Pump not running on Schedule
Posted: Thu Jun 13, 2013 1:20 pm
by lnevo
argh... so sorry..
Code: Select all
byte portalMinutes[numPumps] = { 0, 2, 4 };
byte portalSeconds[numPumps] = { 1, 3, 5 };
Re: Dosing Pump not running on Schedule
Posted: Thu Jun 13, 2013 1:30 pm
by kirkwood
if (bitRead(ReefAngel.Relay.RelayMaskOff, Port7bit)==0) { // ATO relay is manually disabled
atoDisabled=true;
Now I get this error from the above code - 'Port7bit' was not declared in this scope
Re: Dosing Pump not running on Schedule
Posted: Thu Jun 13, 2013 1:38 pm
by lnevo
Port7Bit
Capital B required....
Re: Dosing Pump not running on Schedule
Posted: Thu Jun 13, 2013 1:41 pm
by lnevo
And it looks like your gonna have an error here too:
if (atoDisabled && (bitRead(ReefAngel.Relay.RelayMaskOff, Port7bit)==1)
It should be:
if (atoDisabled && (bitRead(ReefAngel.Relay.RelayMaskOff, Port7bit)==1))
with an extra paren at the end.
Re: Dosing Pump not running on Schedule
Posted: Thu Jun 13, 2013 3:31 pm
by lnevo
Any progress? I'm dying to know the result

Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 6:51 am
by kirkwood
lnevo wrote:Any progress? I'm dying to know the result

yes, I got it uploaded last night - then of course we had a bad storm and lost power for a few hours. Comcast finally got my area back on line this morning. I can see now that ALL the custom fields seem to be logging quality data. I will have to wait and see what it looks like at the end of the day but so far so good.
So basically Custom fields 0,1 (ALK) and 2,3 (CAL) will automatically reset to zero at midnight?
What about the ATO 4,5? Do I have to reset that manually?
Also, how do I get the Custom Fields to display in my portal webcharting?
Thanks for all your help!!!
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 7:31 am
by lnevo
You have to use the links that i showed a while back in the thread. You can change the filter= to get the fields you want. Bookmark them to make it easy to retrieve.
To reset the 4 and 5 just disable the ato port from your phone and then remove the override and it should reset the counter.
Test that part and see if it resets properly.
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 11:02 am
by kirkwood
lnevo wrote:To reset the 4 and 5 just disable the ato port from your phone and then remove the override and it should reset the counter.
Test that part and see if it resets properly.
I manually turned the ATO on via the droid app, then hit the green button to turn the ATO off. This did not reset the custom field counters. I also hit the Clear ATO button on the app and this also did not reset the fields.
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 11:09 am
by kirkwood
I also just took a look at the webcharting for the seconds fields 1 and 3. I expected to see the chart going from 0-60 repeatedly, however this was not the case. Just wondering.
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 11:13 am
by kirkwood
Also I just checked the before and after on custom fields 0,1 when my ALK pump ran on its scheduled cycle. The starting field values were 29 12. My pump runs for 290 seconds. The ending values were 34 4. That equals 292 seconds. Should I expect 100% precision? I'm not overly concerned as I'm just happy the values are very close and allow me to verify my pumps are running about what I expect them to in a given day.
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 11:36 am
by lnevo
Its only going to send values every 5 minutes to the portal so its not going to be a smooth graph. It all depends on the state when the portal sends data.
As far as the ato can you try it again but wait the 5 minutes to make sure portal gets updated?
As far as 292 vs 290. I might be doing a slight bit of math wrong with < > or something like that. But thats pretty good. Keep in mind that the way the tjmer works is it starts when it detects the relay on and stops the timer when it sees that its off, but there may be a slight delay because its going through the loop and drawing screens and stuff so for now 290 vs 292 is pretty good
Let me look at it more closely and see what I can find
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 1:35 pm
by kirkwood
Yeah I'm happy with the values its producing, not trying to be picky. So let me know about whether I'm resetting the ATO values incorrectly because I haven't been able to get that to work.
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 2:09 pm
by lnevo
So the values are definitely not resettting? hmmm I guess I'll have to look at it closer. You'll have to give me some time to work on it.
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 2:34 pm
by lnevo
kirkwood wrote:lnevo wrote:To reset the 4 and 5 just disable the ato port from your phone and then remove the override and it should reset the counter.
Test that part and see if it resets properly.
I manually turned the ATO on via the droid app, then hit the green button to turn the ATO off. This did not reset the custom field counters. I also hit the Clear ATO button on the app and this also did not reset the fields.
Ok, I see what is happening.... the relay is normally off.. so when you hit the override your setting the ON bit, not the OFF, then you're clearing the ON bit so I'm not checking for that... I can change the code, but here's the thing...
I'd rather see the port masked off then on, but I'm not sure how the Android app works. Can you try turning it on, then off (not clearing the override) then once it's forced to off, then clear it.
We can change the checks to search that we're in an override ON position, but the point of it was, that when you saw you're ATO running toward the end, you could just set the port to override OFF and once you knew it was filled back up, then you could release the override and your ATO would operate as normal (assuming you also clear the ATO timeout if triggered...)
Anyway, please test that and let me know. I believe that should take care of it and we can easily change the check to look for the ON mask followed by the clear....
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 2:35 pm
by lnevo
Here's the opposite logic, if you wanted to run with the procedure you described..
Code: Select all
if (bitRead(ReefAngel.Relay.RelayMaskOn, 6)==1) { // ATO relay was forced on
atoDisabled=true; // don't want to change the variable names yet.. but you may want to to make it clearer..
}
if (atoDisabled && (bitRead(ReefAngel.Relay.RelayMaskOn, 6)==0)) { // ATO override has been cleared
pumpTimer[2]=0; // Clear timer for ATOPort
atoDisabled=false;
}
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 5:09 pm
by kirkwood
lnevo wrote:So the values are definitely not resettting? hmmm I guess I'll have to look at it closer. You'll have to give me some time to work on it.
Today is the first full day running the custom fields. I will let you know about 0,1,2,3 and what their values finish at tonight and whether they properly reset to zero at the end of the day.
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 5:14 pm
by lnevo
Please try what i said above as far as resetting the ato tracking...
On then off then clear override..
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 5:33 pm
by kirkwood
I used the new MaskOn logic and when I manually turned the ATO on and then off it cleared all the fields including the dosing pumps. So instead of just clearing field 4,5 it cleared 0,1,2,3,4,5.
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 5:43 pm
by lnevo
Are you sure about that? If you load new code it loses your log...it doesnt get saved anywhere..
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 5:43 pm
by lnevo
Cause there are separate statements for clearing each field...
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 6:48 pm
by kirkwood
lnevo wrote:Are you sure about that? If you load new code it loses your log...it doesnt get saved anywhere..
Oh, I did not know about that. Thanks for bringing to my attention. I will let the ATO fields log some minutes of run time and then I will try to reset them.
Thanks.
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 6:51 pm
by kirkwood
Just an FYI that my Port4 Calcium dosing pump ran for 340 seconds at 9pm. And fields 2 and 3 read 5 40. THAT IS EXACT!!!
nice work Inevo..
Re: Dosing Pump not running on Schedule
Posted: Fri Jun 14, 2013 6:52 pm
by lnevo
Awesome.
Re: Dosing Pump not running on Schedule
Posted: Sat Jun 15, 2013 8:41 pm
by kirkwood
So here is the result from today. Port 3 runs 58 minutes over the course of the day and fields 0and 1 read 58 24. Port 4 runs 68 minutes a day and fields 2 and 3 read 68 0. Wow that's good! Now let's see if they reset at midnight.
I tried clearing the auto today but it didn't work. If I mask the port on do I need to let it run at least 5 minutes to ensure the portal picks it up or does that not matter?
Re: Dosing Pump not running on Schedule
Posted: Sat Jun 15, 2013 8:51 pm
by lnevo
No it *shouldn't* matter how long. as long as the function runs once and picks up the mask and then sees it change. It only looks at the masks because we dont' want it to reset every time the ato triggers... I'm lost as to why the resets not working.. we may need to figure out a way to debug it better. I'll have to see what I can play with on my end. It would be helpful if you could post your full code at some point. Maybe start a PDE thread in the My PDE/INO forum. It would probably help a lot of people, your doing cool stuff now

Re: Dosing Pump not running on Schedule
Posted: Sun Jun 16, 2013 2:41 pm
by lnevo
I know what is wrong!!!!!
I mixed up the usage of the Port7Bit.
The arg to bitRead should be the position from [0-7] so for Port7 use 6 instead of Port7Bit!