ATO port, momentary switch, feeding mode

Basic / Standard Reef Angel hardware
Post Reply
New2novas
Posts: 32
Joined: Wed Sep 18, 2013 6:17 pm

ATO port, momentary switch, feeding mode

Post by New2novas »

I thought this wouldve been easier to find by searching but apparently not. My unit is in the basement while DT is upstairs. I don't want to have to access portal every time i want to enter feeding mode, which is mostly stop water movement so i can see into the tank cause i only have access from the rear of it mode, and was wondering if this was a possibility. At the moment, and foreseeable future i will not be using the ATO ports, could i have a momentary switch wired to that port activate the feeding mode?
Image
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: ATO port, momentary switch, feeding mode

Post by binder »

I would think that you could do something like this. You would simply need to monitor the ato port to see if the connection is made and then have the controller enter the feeding mode when this happens. You could probably even have it set to hold the switch for 5 seconds (or something like that) before entering the mode, this way you could prevent accidental triggers.

I'm sure lee or others may chime in with examples for you but I would think that this would be fairly straightforward to accomplish. If nobody chimes in with an answer, then I'm sure I could write up something for you that would work.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: ATO port, momentary switch, feeding mode

Post by lnevo »

if (ReefAngel.LowATO.IsActive()) FeedingModeStart();

Keep it simple :)

But yeah we could figure out all kinds of method to toggle/safeguard/cancel.

Morse code to RA :)
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: ATO port, momentary switch, feeding mode

Post by binder »

Yeah, that's what i was thinking as well.
New2novas
Posts: 32
Joined: Wed Sep 18, 2013 6:17 pm

Re: ATO port, momentary switch, feeding mode

Post by New2novas »

I really liked curts idea of holding the switch as i was originally thinking that to avoid every time i';m in the cabinet putting it in feeding mode. Now i'm trying to learn how this code works and although i can't speculate, what would you add to that previous code to have the port see continuity for 2 seconds before triggering

can you put the time of holding switch......if (ReefAngel.LowATO.IsActive(HERE)) FeedingModeStart();

feeding mode is just a count down correct? what if i want to exit it early.... how would the code be written for if feedingmode counts >0 and lowATO active then cancel feedingmode
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: ATO port, momentary switch, feeding mode

Post by lnevo »

I'll try and put something together in next few days.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: ATO port, momentary switch, feeding mode

Post by binder »

You could do something like this:

Code: Select all

// place this line above setup()
time_t startButtonPress = 0;

void setup()
{
	// existing code
}

void loop()
{
	// existing code ...
	
	
	// if port is activated and we are in the default menu mode
	if ( (ReefAngel.LowATO.IsActive()) &&
		 (ReefAngel.DisplayedMenu == DEFAULT_MENU) ) {
		// button pressed / port activated
		if ( startButtonPress == 0 ) {
			// if it's the initial button press, set the start
			// time to now
			startButtonPress = now();
		}
		// check if the elapsed time is greater than 2 seconds
		if ( (now() - startButtonPress) > 2 ) {
			// start feeding mode and reset button press
			startButtonPress = 0;
			FeedingModeStart();
		}
	}
	
	// existing code ...
}
It makes sure you are in the default menu mode (main mode, aka not in Water Change Mode or Feeding Mode) before it even attempts to proceed any further. It then checks if the low pin ato port is activated. if it's activated, it checks to see if the starting button press time is set, if it's not set, it sets it to the current time. next, it checks for the elapsed time between now and when you started pressing the button. (This value, 2, may need to be increased but I believe it should be just fine since now() returns the number of seconds.). Once 2 seconds has elapsed, it starts feeding mode and resets the start of the button press. So you just hold the button down until feeding mode starts and then you can release the button.

I have not tested this and others may comment on it to improve it, but it should work just fine for you. You may need to tweak it some. This should get you started though.
New2novas
Posts: 32
Joined: Wed Sep 18, 2013 6:17 pm

Re: ATO port, momentary switch, feeding mode

Post by New2novas »

Wow you rock!

i'm not yet ready to implement this and as soon as i do i will report back, now i need to study up on this more, i'll start by reverse engineering your code. Cause to be honest i don't even know where to put that LOL
Image
Post Reply